1. 修改程序清单11.5,使之将一系列连续的随机漫步者位置写入到文件中。对于每个位置,用步号进行标志。另外,让该程序将初始条件(目标距离和步长)以及结果小结写入到该文件中。该文件的内容与下面类似: Target Dis…
标签:C++ Primer Plus
C++ Primer Plus [第六版]第10章编程练习题答案
1. #ifndef BANK_H_ #define BANK_H_ #include <string> class Bank { private: std::string name; std::string…
C++ Primer Plus [第六版]第10章复习题答案
5 #ifndef BANK_H_ #define BANK_H_ #include <string> class Bank { private: std::string name; std::string …
C++ Primer Plus [第六版]第9章编程练习题答案
1 #ifndef GOLF_H_ #define GOLF_H_ const int Len = 40; struct golf { char fullname[Len]; int handicap; }; void …
C++ Primer Plus [第六版]第9章复习题答案
3 #include <iostream> int main() { double x; std::cout << "请输入值: "; while (!(std::cin >> x))…
C++ Primer Plus [第六版]第8章编程练习题答案
1 #include <iostream> void show(const char *str, int n = 1); int main() { show("hello world!"); show("你好…
C++ Primer Plus [第六版]第8章复习题答案
4. 下面是一个结构模板: struct box { char maker[40]; float height; float width; float length; float volume; }; a. 编写一个函数…
C++ Primer Plus [第六版]第7章编程练习题答案
1 #include <iostream> double num(double x, double y); int main() { using namespace std; double n, m; cou…
C++ Primer Plus [第六版]第7章复习题答案
复习题一般我只把书上写不下的发布出来,其他的都在书上直接做了 8 编写一个函数,其原型如下: int replace(char * str, char c1, char c2); 该函数将字符串中所有的c1都替换为c2,…
C++ Primer Plus [第六版]第6章编程练习题答案
1 #include <iostream> #include <cctype> int main() { using namespace std; char ch; while ((ch = ci…