I've bumped into a problem. I'm trying to store user entered values into an array until they enter -1 by using a do-while loop. Here's a sample of my code:
int j=0;
do{
cin >> nodes[j];
j++;
}
while (nodes[j] != -1);
Can someone tell me why this doesn't work and what a better approach would be? Thanks!
tj` already incremented when the comparisonnodes[j] != -1is made?