editing a nested loop

This is a nested loop program that I am trying to edit so that it only counts up to 10, but I don't know how to make it stop. I made it so that that the number doesn't go beyond two digits, but I don't know how to make it stop at 10 without messing up the type of digits the program outputs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iomanip> 
#include <iostream> 
using namespace std; 
  
#ifdef GPP 
#include <unistd.h> 
#else 
#include <cstdlib> 
#endif 
  
int main() 
{ 
  cout << "CTRL-C to exit...\n"; 
  

      for (int tens = 0; tens < 10; tens++) 
      { 
        for (int units = 0; units < 10; units++) 
        { 
          cout  << tens << units << ' '; 
          cout.flush(); 


  
          #ifdef GPP 
          sleep(1); // one second 
          #else 
          _sleep(1000); // one thousand milliseconds 
          #endif 


  
          cout << '\r'; // CR 

    } 
  } 
  return 0; 
} // main 
Your loop stops at 100 total, which would be 100 seconds. I'm not quite sure what your issue if though.
Topic archived. No new replies allowed.