Console display help

Hi guys,

Wondering if there's a way to control the page breaks in console. For example, if I create a list such as:

1
2
3
for(int i=0;i<1000;i++){
 cout<<i<<endl;
}


is there a way to fill the console display up the bottom of the page, then press a button, and display to the bottom etc.

Right now, whenever I create a long list, console just outputs everything, and I have scroll up, which is really annoying.

Thanks,

Mike
1
2
3
4
5
6
7
8
9
for(int i=0;i<1000;i++)
{
   if(i%50 == 0)
   {
      //getchar() or cin or Sleep(ms)
   }
   cout<<i<<endl;
}
 
Last edited on
I considered that. Are there no other ways?

Mike
Can't think of any.
How does the console know when the screen is filled with new output when it is already full ? I imagine u could do something custom like (for windows) get the client rectangle and depending on its height - output the next x lines as defined by ur prog.
I don't know about creating pages(If there is inbuilt system).But you can use like this for one page display.

1
2
3
4
5
6
7
8
9
10
11
int x=1,y=1;
for(int i=0;i<1000;i++)
{
   if(i%50 == 0)
   {
      x+=2;
      y=0;
   }
   gotoxy(x,y++);
   cout<<i<<endl;
}


For medium projects divide the call in parts(arguments in function),then pass page no and print on screen.(if you want an example then I can program one for you.)

For big projects If you want to create pages then you have to use additional file and menus for format.
Last edited on
Topic archived. No new replies allowed.