0

How to compare string in arrays???

30th Mar 2019, 6:52 PM
EDWIN O. FELICIANO PONCE
EDWIN O. FELICIANO PONCE - avatar
11 odpowiedzi
+ 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; }
31st Mar 2019, 10:38 PM
Zeke Williams
Zeke Williams - avatar
+ 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
31st Mar 2019, 4:25 PM
Zeke Williams
Zeke Williams - avatar
+ 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);
31st Mar 2019, 4:29 PM
Zeke Williams
Zeke Williams - avatar
+ 1
yes!! that work now the program work at 100% really thanks for your help and the help of the others!
1st Apr 2019, 4:43 AM
EDWIN O. FELICIANO PONCE
EDWIN O. FELICIANO PONCE - avatar
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
30th Mar 2019, 7:02 PM
EDWIN O. FELICIANO PONCE
EDWIN O. FELICIANO PONCE - avatar
0
i tried but not work :'(
30th Mar 2019, 9:33 PM
EDWIN O. FELICIANO PONCE
EDWIN O. FELICIANO PONCE - avatar
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 😛
31st Mar 2019, 5:26 AM
Zeke Williams
Zeke Williams - avatar
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
31st Mar 2019, 12:41 PM
EDWIN O. FELICIANO PONCE
EDWIN O. FELICIANO PONCE - avatar
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
31st Mar 2019, 9:21 PM
EDWIN O. FELICIANO PONCE
EDWIN O. FELICIANO PONCE - avatar