- 博客(18)
- 收藏
- 关注
原创 c++ Primer Plus(第六版)第十八章习题,写代码之路
c++ Primer Plus(习题18.1) //与c类似的初始化列表功能 //简单的函数题目,这本书的最后一张其实可以不用做了 //不太好做 #include #include //C++11新标准 template //or typename T average_list(std::initializer_listr); //一个返回改类型平均值的函数 int main() {
2017-02-08 20:29:52
549
原创 c++ Primer Plus(第六版)第十七章习题,写代码之路
c++ Primer Plus(习题17.1) //编写一个程序计算$之前的字符数,并且把它留在输入流中 #include int main() { using namespace std; cout << "Enter a text,report the number(end with $):\n"; int count=0; char r; while (cin.peek()!='
2017-02-08 20:25:25
1235
原创 c++ Primer Plus(第六版)第十六章习题,写代码之路
c++ Primer Plus(习题16.1) //让用户输入回文的单词,就是那种倒着读和顺着读一样意思的 //实现这个功能有很多方法,用了一种简单的方法 #include #include using std::string; using std ::cout; using std::cin; using std::getline; using std::endl; bool Isplalin
2017-02-08 20:19:45
1702
原创 c++ Primer Plus(第六版)第十⑤章习题,写代码之路
c++ Primer Plus(习题15.1) //对书上的友元类进行成员的增加 // 一种简单的修改 #include #include"tv.h" int main() { using std::cout; Tv s42; cout << "Initial settings for 42: \n"; s42.settings(); s42.onoOff(); cout << "\
2017-02-08 20:11:42
662
原创 c++ Primer Plus(第六版)第十四章习题,写代码之路
c++ Primer Plus(习题14.1) //书上的测试文件,相当于客户的使用说明书 //对于书上那个Pair对象,不认真的人都怀疑是否学过 //竟然是一个模板,这道题目想了很久很久,还是没思路 //看网上的习题,才学会了模仿,总之还是书上没完全就看懂,才会出现这种问题 //两题一样的测试文件 #include #include"winec.h" int main() { using s
2017-02-08 19:57:50
1800
原创 c++ Primer Plus(第六版)第十三章习题,写代码之路
c++ Primer Plus(习题13.1) /*13.1题的实现文件,书上的测试文件*/ //哪个方法不需要也根据实现而定,始终跟随客户的脚步 //这题细节方面被坑了,mainworks字符数组设置太小了,导致了一系列不可思议的问题 #include #include"classic.h" using namespace std; void Bravo(const Cd&disk); int
2017-02-08 19:49:56
728
原创 c++ Primer Plus(第六版)第十二章习题,写代码之路
c++ Primer Plus(习题12.1) //12.1头文件 #pragma once #ifndef COW_H #define COW_H #include #include class Cow { private: char name[20]; char *hobby; double weight; public: Cow(); Cow(const char* nm, co
2017-01-20 13:01:53
1427
原创 c++ Primer Plus(第六版)第八章习题,写代码之路
c++ Primer Plus(习题8.1) /*题意看了好久才明白意思,即不依赖形参n,来输出字符串*/ /*个人见解,无*/ #include const int TIMES = 10; int count = 0; //用一个全局变量,记录函数调用次数 void show(const char *p, int n = 0); int main() { using names
2017-01-20 11:56:33
601
原创 c++ Primer Plus(第六版)第七章习题,写代码之路
c++ Primer Plus(习题7.1) //用户输入啷个数,返回调和平均数 //其中一个为0结束程序 #include using namespace std; double t_average(double a, double b); int main() { cout << "Please two interger: "; double x, y; while (cin >> x
2017-01-20 11:53:15
1320
原创 c++ Primer Plus(第六版)第九章编程练习之路
c++ Primer Plus(习题9.1) /*golf.h习题9.1头文件*/ #pragma once #ifndef GOLF_H #define GOLF_H //习惯的用法 const int Len = 40; //存储名字的长度 //golf结构 struct golf { char fullname[Len]; int handic
2017-01-07 09:41:49
423
原创 c++primer plus 第4章编程练习之路
c++ Primer Plus(习题4.1) #include const int Lengh = 10; int main() { using namespace std; cout << "what is your frist name? "; char fristname[Lengh]; cin.getline(fristname, Lengh); cout << "what i
2017-01-03 20:01:27
635
原创 c++primer plus 第六版 第2章 编程练习之路
//c++ Primer Plus(习题2.2)//input 以 long为单位的距离,将它转换成码.(1 long =220码) #include const float Yard = 220;int main(){using namespace std;cout> result;cout << result << "long change to Yard is " << result
2017-01-03 19:54:19
469
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人