码迷,mamicode.com
首页 >  
搜索关键字:cout    ( 7219个结果
27.数列1,2,2,3,3,3,4,4,4,4,5,……
?#includeusing namespace std;int main(){ for(int i=1;i<=10;i++) { for(int j=1;j<=i;j++) { cout<<i<<" "; } ...
分类:其他好文   时间:2014-08-06 21:57:12    阅读次数:173
Linux后台运行
在Linux中有时你需要将脚本(test.sh)和可执行程序(exe)后台执行,请使用如下方式: nohup ./test.sh & nohup ./exe & 这样执行的程序可以彻底在后台运行,为什么呢?因为如果你的脚本或者可执行程序中有echo,cout这种向标准输出设备输送内容的指令,普通的后台运行: ./test.sh & ./exe & 是无法满足要求的,当指令往标准...
分类:系统相关   时间:2014-08-06 19:23:15    阅读次数:277
24.定义一个整型变量,赋予1-100值。要求用户猜这个数,比较两数大小,把结果提示给用户,直到猜对为止
?#includeusing namespace std;int main(){ int a=50; int n; while(1)//关键,造成一个死循环 { cout>n; if(a==n)//循环退出条件 { coutn) { cout<<"...
分类:其他好文   时间:2014-08-06 18:45:31    阅读次数:258
25.(需要好好研究研究)输入任意的正整数,将其各位分离出来;求它是几位数,求各位上数字的和,求其逆值
#includeusing namespace std;int main(){ int m,n,i,j=1,k=0,a[20],x,y; cout>m;//输入的数为m y=m;//先将m赋值给y,将原始输入的数保护起来 for(i=1;;i++)//中间的判断条件可以不要,就变成了死循环 ...
分类:其他好文   时间:2014-08-06 18:31:11    阅读次数:696
20.输出图形
*************************#includeusing namespace std;int main(){ for(int i=1;i=0;m--) { for(int n=1;n<=m;n++) { cout<<"*"; } cout<<...
分类:其他好文   时间:2014-08-06 14:13:01    阅读次数:217
C++ Primer【第五版】习题参考答案——第六章(函数)
本系列文章会不断更新,但是时间不能保证。另外基本上都是自己做的答案,仅供参考,如果有疑问欢迎交流。 #include #include using namespace std; int test_Ex_6_27(std::initializer_list li); int main() {     cout     return 0; } int test_Ex_6_27...
分类:编程语言   时间:2014-08-05 22:32:10    阅读次数:232
hash应用以及vector的使用简介:POJ 3349 Snowflake Snow Snowflakes
今天学的hash。说实话还没怎么搞懂,明天有时间把知识点总结写了,今天就小小的写个结题报告吧!题意: 在n (n.(2)创建vector对象,vector vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout::iterator it;for(it=vec....
分类:其他好文   时间:2014-08-05 22:26:30    阅读次数:297
17.求圆周率PI: PI/4 = 1- 1/3 + 1/5 -1/7 +.....
#includeusing namespace std;int YuanZhou(int);int main(){ int n; double temp,sum=0; cout>n; for(int i=1;i<=n;i++) { if(i%2==0) { temp=...
分类:其他好文   时间:2014-08-05 22:22:50    阅读次数:209
18.把1~100存到一维数组a[100]中,并输出。要求每行输出10个,数据所占宽度相同。
#includeusing namespace std;int main(){ int a[101]; for(int i=1;i<=100;i++) { a[i]=i; } for(int j=1;j<=100;j++) { cout<<a[j]<<" "; if(j...
分类:其他好文   时间:2014-08-05 22:21:10    阅读次数:256
c++11之一: 基于范围的for循环
#include using namespace std; int main(){ int ary[5]{1,2,3,4,5}; for (int& e: ary) e *= 2; for (int e: ary) cout<<e<<'\t'...
分类:编程语言   时间:2014-08-05 13:54:09    阅读次数:209
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!