Hey, I am new to this site and am seeking help with fixing this code. It's supposed to take user input to replace specific parts of an array of size 10. Putting an if statement to make it so that the user wouldn't be able to put index numbers above 9 or below 0 doesn't seem to make the do-while statement end, and was wondering where I went wrong. Any help would be greatly appreciated!
You have two problems with your code that makes me wonder if you compiled the program to reveal these.
In lines 18 and 25 the "or" is not a keyword and will not work the way you are thinking. In the case of "or" the proper symbol is "||" and for "and" it is "&&". Also the inner () are not really needed.
In lines 6 and 9 the "c = c + 1" will work, but this i more commonly written as "c++" or "++c".
This is what I see, but I still want to test the program.
Thank you for the advice. I modified lines 18 and 25 to have the actual symbol for OR. When looking at it further, I realized how silly i was for putting the OR there instead of AND to to basically say IF(-1<i<10), and now the code seems to be working just fine. Thanks!