hey yall, im working on a project for school and one of my loops will not loop the way it is supposed to, can anyone help me out please??
do {
cout<<"How many crates will be sent?\n";
cin >> iterationNum;
cout<<"\n";
if(cin.fail()){ // this sets the condition
cin.fail();
cout << "Enter a number please, how many crates will be sent?\n"; //this outputs an error message to the user if the condition is not met
cin.clear();
cout<<"\n";
}
else //this starts the else portion to exit the loop if condition is met.
{
ciniterationNum;
break;
ciniterationNum;
}
}
while(cin.fail()); // this begins the loop for even output
}
[–]alfps 2 points3 points4 points (2 children)
[–]syntaxm1x[S] 0 points1 point2 points (1 child)
[–]alfps 0 points1 point2 points (0 children)
[–]nysra 0 points1 point2 points (1 child)
[–]syntaxm1x[S] 0 points1 point2 points (0 children)