Exit a loop

Hi,

I need to be able to exit a loop when a specific key is pressed (yes i have seen the other threads about this and none of them work).

I would like to be able to use the functions within the conio.h library to do this, but cant figure out how.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cstdlib>
#include <iostream>

using namespace std;

main()
{
      int number=0, number2=0;
      
      for (number=0; number <1000001; number++) //number <=10 or number <11
      {
       printf("%d ", number);
      }

printf("\n");

system ("pause");
}




Thanks,
Stephen
Topic archived. No new replies allowed.