controlling the output on each line

how do we control the number of output on each line?


#include <iostream>
#include <cstdlib>
using namespace std;
int main(void)
{
int number;

for (number=32;number<=126;number++)
{
cout<<number;
cout<<" ";
cout<<(char)number;
cout<<" ";
}
cout<<endl;
system("pause");
return 0;
}


how to edit until the output is something like...

32 33 ! 34 " 35 # 36 $ ----> 1 line
37 ! ----> 1 line
in the for block something like if((number-32)%5==4)cout<<endl;
1
2
3
4
5
6
7
{
cout<<number;
cout<<" ";
cout<<(char)number;
cout<<" ";
if((number-32)%5==4)cout<<endl;
}


thanks man csiz u r the greatest
Topic archived. No new replies allowed.