欢迎来到天天文库
浏览记录
ID:47799314
大小:22.00 KB
页数:11页
时间:2020-01-17
《Thinking in C++答案第二章》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ThinkinginC++Chapter22-1:修改Hello.cpp,使它能打印你的名字和年龄(或者你的鞋码,爱犬的年龄等,只要你喜欢)。编译并运行修改后的程序代码:#includeusingnamespacestd;intmain(){cout<<"MynameisLJ."<2、制格式打印。(他们只适用于整数类型)代码:#includeusingnamespacestd;intmain(){floatr;精选范本,供参考!cin>>r;cout<<"圆的面积为"<<3.14*r*r<#include#includeusingnamespacestd;intmain(){inti=0;ifstreamin("Space.txt"3、);stringword;while(in>>word){cout<#include#includeusingnamespacestd;intmain(){stringword;ifstreamin("Search.txt");stri4、ngstandard="we";intnumber=0;while(in>>word){if(word==standard){number++;}}cout<#include#include#includeusingnamespacestd;intmain(){vector5、g>ve;ifstreamin("Space.txt");stringline;while(getline(in,line)){ve.push_back(line);}for(inti=ve.size()-1;i>=0;i--){cout<#include#include#inclu6、deusingnamespacestd;intmain(){vectorv;ifstreamin("Conn.txt");stringline;intnumber=0;inti=0;while(getline(in,line)){v.push_back(line);}stringli;精选范本,供参考!for(;i7、ostream>#include#includeusingnamespacestd;intmain(intargc,char*argv[]){stringline;ifstreamin("Dis.txt");chari=getchar();while(getline(in,line)){精选范本,供参考!if(i==''){cout<,并用一个for循环语句向它输入25个浮点数,显示vector的结果。8、代码:#include#includeusingnamespacestd;intmain(){vectorv;floattempt;inti=0;for(i
2、制格式打印。(他们只适用于整数类型)代码:#includeusingnamespacestd;intmain(){floatr;精选范本,供参考!cin>>r;cout<<"圆的面积为"<<3.14*r*r<#include#includeusingnamespacestd;intmain(){inti=0;ifstreamin("Space.txt"
3、);stringword;while(in>>word){cout<#include#includeusingnamespacestd;intmain(){stringword;ifstreamin("Search.txt");stri
4、ngstandard="we";intnumber=0;while(in>>word){if(word==standard){number++;}}cout<#include#include#includeusingnamespacestd;intmain(){vector5、g>ve;ifstreamin("Space.txt");stringline;while(getline(in,line)){ve.push_back(line);}for(inti=ve.size()-1;i>=0;i--){cout<#include#include#inclu6、deusingnamespacestd;intmain(){vectorv;ifstreamin("Conn.txt");stringline;intnumber=0;inti=0;while(getline(in,line)){v.push_back(line);}stringli;精选范本,供参考!for(;i7、ostream>#include#includeusingnamespacestd;intmain(intargc,char*argv[]){stringline;ifstreamin("Dis.txt");chari=getchar();while(getline(in,line)){精选范本,供参考!if(i==''){cout<,并用一个for循环语句向它输入25个浮点数,显示vector的结果。8、代码:#include#includeusingnamespacestd;intmain(){vectorv;floattempt;inti=0;for(i
5、g>ve;ifstreamin("Space.txt");stringline;while(getline(in,line)){ve.push_back(line);}for(inti=ve.size()-1;i>=0;i--){cout<#include#include#inclu
6、deusingnamespacestd;intmain(){vectorv;ifstreamin("Conn.txt");stringline;intnumber=0;inti=0;while(getline(in,line)){v.push_back(line);}stringli;精选范本,供参考!for(;i7、ostream>#include#includeusingnamespacestd;intmain(intargc,char*argv[]){stringline;ifstreamin("Dis.txt");chari=getchar();while(getline(in,line)){精选范本,供参考!if(i==''){cout<,并用一个for循环语句向它输入25个浮点数,显示vector的结果。8、代码:#include#includeusingnamespacestd;intmain(){vectorv;floattempt;inti=0;for(i
7、ostream>#include#includeusingnamespacestd;intmain(intargc,char*argv[]){stringline;ifstreamin("Dis.txt");chari=getchar();while(getline(in,line)){精选范本,供参考!if(i==''){cout<,并用一个for循环语句向它输入25个浮点数,显示vector的结果。
8、代码:#include#includeusingnamespacestd;intmain(){vectorv;floattempt;inti=0;for(i
此文档下载收益归作者所有