如何在c ++中创建一行 [英] how to create a row in c++

查看:69
本文介绍了如何在c ++中创建一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有这个问题。如果有人能帮助我,我将不胜感激。我在输出中想要这样的东西

过程:1 2 3 4 5 





这里是我的代码

 cout<<   process<< ENDL; 
for (i = 0 ; i< n; i ++)>
{
cout<< \ n\t< ;< I + 1·;< ENDL;
}





任何人都可以帮我这个。谢谢

解决方案

你必须用以下格式写:



 cout <  <process    :;   

for(i = 0; i< n; i ++ ) >
{
cout < < setw(3)<< i + 1;

// OR

// cout << \t< < i + 1;

}



输出 是: 1 2 3 4 5 ....


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

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



Can anyone help me with this. Thanks

解决方案

you must write in this format:

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 ....


这篇关于如何在c ++中创建一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆