Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
So, i have this problem. I would appreciate if anyone can help me out. I want something like this in my output
process: 1 2 3 4 5


here is my code
C++
cout<<"process"<<endl;
for(i=0;i<n;i++)>
{
    cout<<"\n\t"<<i+1<<endl;
}


Can anyone help me with this. Thanks
Posted
Updated 26-Jul-14 12:45pm
v2
Comments
Andreas Gieriet 26-Jul-14 18:43pm    
What is the problem? Formatting? Does not compile without error?
Andi

1 solution

you must write in this format:

XML
cout<<"process :";
for(i=0;i<n;i++)>
{
    cout<<setw(3)<<i+1;
//OR
//cout <<\t<<i+1;
}

output is: 1  2  3  4  5 ....
 
Share this answer
 
Comments
Surajit Das 27-Jul-14 7:35am    
Hey thanks for your reply sattari. I tried your code but it gives me error. When i use setw(3) it shows error by saying setw is undefined. Do i need to include any library for that?
Also, when i tried the other one \t it shows error by saying "unrecognized token"
Abhinav Gauniyal 27-Jul-14 12:53pm    
iomanip.h?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900