exiting loop upon negative number
solved
Last edited on
Try to use signed operator
signed double scores=100;
i still cannot make it to exit upon entering negative number.
1 2
|
Try to use signed operator
signed double scores=100;
|
Lol, what?
Anyway. Look up jump statements. Particulary
break
and
continue
.
Example:
1 2 3 4 5 6 7
|
for (int i = 0; i < 10; ++i)
{
if (i == 5) {
break;
}
std::cout << i << " ";
}
|
The above will only print
1 2 3 4
, as when
i == 5
,
break
will terminate the loop.
thank you sasauke . idk what bunny meant but i finally got it.
@curiousfloridian
Could we ask you not to delete your question once it is solved? It may be helpful to others who have a similar problem.
Cheers :+)
Topic archived. No new replies allowed.