Friday, July 31, 2009

Help with c++ program?

#include %26lt;iostream.h%26gt;


#include %26lt;iomanip.h%26gt;


#include %26lt;stdlib.h%26gt;


#include %26lt;ctype.h%26gt;


#include %26lt;fstream.h%26gt;


#include %26lt;conio.h%26gt;


using namespace std;





int main()


{


char ans[20]= {'B','D','A','A','


C','A','B',


'A','C','D','B','C','D','A','


D','C','C','B','D','A'};


char studentans[3][20];


int identity[3][20];


int totalwrong[3];





for(int count1 = 0;count1%26lt;3;count1++)


{


for(int count2 = 0;count2%26lt;20;count2++)


{


do


{


cout%26lt;%26lt;"Person #"%26lt;%26lt;


(count1+1)%26lt;%26lt;" question #"


%26lt;%26lt;(count2+1)%26lt;%26lt;"- ";


cin%26gt;%26gt;studentans


[count1][count2];


studentans


[count1][count2] = toupper


(studentans[count1][count2]);


}


while(studentans[count1]


[count2] != 'A' %26amp;%26amp;


studentans[count1]


[count2] != 'B' %26amp;%26amp;


studentans[count1]


[count2] != 'C' %26amp;%26amp;


studentans[count1]


[count2] != 'D');


}


}

Help with c++ program?
The only problem is you aren't initializing the totalwrong array. Do this before you use it:





memset(totalwrong,0,sizeof(totalwrong)...


No comments:

Post a Comment