arrays - c++ checking to see if data is equal or not -
I am writing a program and check whether the character described by the user is equal to one of the characters in an array . If it is not equal to anyone then it should be displayed "invalid ...." It is not working for me, someone can tell me what I am doing wrong. I am getting an illegal character every time
I have a four array data [5]; Which stores 5 letters
cout & lt; & Lt; "Enter a character to delete:"; CIN & gt; & Gt; Dell; The court's & lt; & Lt; Dell; For (int x = 0; x & lt; 4; x ++) {if (del! = Data [x]) {cout & lt; & Lt; "Invalid, character is not entered. \ N"; break; }}
for (int x = 0; x & lt; 5; x ++) {If (del == data [x]) {cout & lt; & Lt; "Found on the character" & lt; & Lt; X & LT; & Lt; Endl; break; }} If (x == 5) cott & Lt; "Character not found" & lt; & Lt; Endl;
Comments
Post a Comment