[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Kan ikke finde fejl.



Jeg har dette stykke kode:
Variablen "level" har værdien 20;

ifstream persons ("persons");
for (int nr = 0 ; nr <= level * 4 ; nr++) {
	monsters.getline(personsline, 10);
}
for (int nr = 0 ; nr < 4 ; nr++) {
	monsters.getline(personsline, 10);
	sscanf(personsline, "%d %d %d %d", &personarray1[nr], &personarray2[nr], &personarray3[nr], &personarray4[nr]);
	personarray2[nr] = personarray2[nr] * 40;
	personarray3[nr] = personarray3[nr] * 40;
	if (personarray1[nr] + personarray2[nr] + personarray3[nr] + personarray4[nr] == 0) {
		nr = 4;
	}
	cout << personarray1[nr] << endl;
	cout << personarray2[nr] << endl;
	cout << personarray3[nr] << endl;
	cout << personarray4[nr] << endl;
}

Og på linie 81 i filen "persons" står der "2 7 3 1".
Men når jeg kører programmet giver det:
0
0
0
0


Håber I kan hjælpe!


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *