0
How to compare string in arrays???
9 Answers
+ 3
So you will have to go through each student that has been created so far and compare the currently entered id to the existing id's. You should do this in your id_check function. And since you are passing the loop counter to your function, you can use that in your new loop when you check the accounts that have already been created. Then just return idch=true if any are equal.
for (int x = 0; x < id; ++x) {
if (acc[x].student_num == acc[id].student_num)
return idch=true;
}
+ 3
So what exactly is happening now that isn't working. When you enter the same name? When you enter the same id? It would help to know what the issue is so I don't have to look at all of this code
+ 2
I did notice this in name_check:
while (name_check(nch));
You don't want to call name check in the loop and then call it again in the condition. Just call it once in the loop and set it to a bool (since it returns one).
bool a = name_check(c);
} while (a);
+ 1
yes!! that work now the program work at 100% really thanks for your help and the help of the others!
0
i want to compare like this to make the useres reenter the code if i entered before
https://code.sololearn.com/cPKNa50ISPt1/?ref=app
0
i tried but not work :'(
0
Where is accnum being set?
Nevermind I see now. It's a global variable, which I don't like, but I'll keep looking đ
0
i only want to repeat the option if i entered the number before this isnthe reason i want to check the current input with others
0
i fixed thants, but only left one thing is the check of the id number to not repeat the same, i want to repeat the option of input the code if i entered before
https://code.sololearn.com/cnn9435oeXoM/?ref=app