hey guys, im new to C++ and im doin an assignment. In my problem, you gotta search for a student's name and then make the program display the name, corresponding marks and the grading. I've got everything else right, but the grading just doesnt work. I get an error called x is not initialized. Can anyone help me with the prob? I need to hand this over asap.
void displaynames(){
string seek;
int i,x;
cout<< "Enter a student's name"<<endl;
cin >> seek;
for (i=0;i<10;i++){
if (nameArray[i]==seek){
It looks like maybe you have your assignment backwards: markArray[i]=x;
Maybe it should be: x=markArray[i];
Or better yet just use makArray[i] in your if/else chain.
@jlb and @Chervil , thnks so much guys!!! I tried it n it works! how stupid of me, i've indeed had my assignment backwards!
thank you guys sooo much for your time! Ur A.W.E.S.O.M.E !!!!