[try Beta version]
Not logged in

 
 
exiting loop upon negative number

Feb 29, 2016 at 3:18am
solved
Last edited on Feb 29, 2016 at 6:14am
Feb 29, 2016 at 4:11am
Try to use signed operator
signed double scores=100;
Feb 29, 2016 at 5:06am
i still cannot make it to exit upon entering negative number.
Feb 29, 2016 at 5:42am
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.
Feb 29, 2016 at 6:14am
thank you sasauke . idk what bunny meant but i finally got it.
Feb 29, 2016 at 6:44am
@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.