《C++PrimerPlus中文第六版第五章编程练习》由会员分享,可在线阅读,更多相关《C++PrimerPlus中文第六版第五章编程练习(6页珍藏版)》请在金锄头文库上搜索。
1、C+PrimerPlusC+PrimerPlus 中文第六版第五中文第六版第五章编程练习章编程练习/刚接触C+,学习过程中自己编写的课后练习。只用了一个main函数,用注释把各个题目分开了 / practice.cpp : 定义控制台应用程序的入口点。 /#include “stdafx.h“ #include #include /#include int main() using namespace std; /1 /* int min_int,max_int; long count = 0; cout min_int; cout max_int; for (;min_int shu; wh
2、ile ( shu!=0 ) he += shu; cout shu; cout shuliangi; for (i = 0,shuliang12 = 0;i three_yearsij; three_yearsi12 += three_yearsij; for (i = 0;i qicheshu; cin.get();/避免getline()读入空行 car * pt = new carqicheshu; int i; for (i = 0;i shengchanshang); cout (pt + i) - year; cin.get();/避免getline()读入空行 cout yea
3、r shengchanshang word; while (strcmp(word,“done“) != 0) count+; cin word; cout str; while (str != “done“) count+; cin str; cout star; int i,j; for (i = 1; i = star;i+) for (j = 0;j star - i;j+) cout “.“; for (;j star;j+) cout “*“; cout endl; cout “Press any key to return.“; cin.get(); cin.get(); return 0;