首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
【C++ Primer Plus】编程练习答案——第6章
】的更多相关文章
【C++ Primer Plus】编程练习答案——第12章
1 // chapter12_1_cow.h 2 3 4 #ifndef LEARN_CPP_CHAPTER12_1_COW_H 5 #define LEARN_CPP_CHAPTER12_1_COW_H 6 7 class Cow { 8 private: 9 char name_[20]; 10 char * hobby_; 11 double weight_; 12 public: 13 Cow(); 14 Cow(const char * name, const char * hobby…
【C++ Primer Plus】编程练习答案——第11章 (待更新)
最近开学,事情较多,过两天更新...…
【C++ Primer Plus】编程练习答案——第10章
1 // chapter10_1_account.h 2 3 #ifndef LEARN_CPP_CHAPTER10_1_ACCOUNT_H 4 #define LEARN_CPP_CHAPTER10_1_ACCOUNT_H 5 6 #include <iostream> 7 #include <string> 8 9 10 class Account { 11 private: 12 std::string name_; 13 std::string id_; 14 double…
【C++ Primer Plus】编程练习答案——第9章
1 // chapter09_golf.h 2 3 #ifndef LEARN_CPP_CHAPTER09_GOLF_H 4 #define LEARN_CPP_CHAPTER09_GOLF_H 5 6 #include <cstring> 7 #include <iostream> 8 9 const int Len = 40; 10 struct golf { 11 char fullname[Len]; 12 int handicap; 13 }; 14 15 void se…
【C++ Primer Plus】编程练习答案——第8章
1 void ch8_1_print(const std::string & str, int n = 0 ) { 2 using namespace std; 3 static int flag = 0; 4 ++ flag; 5 if (!n) 6 cout << str << endl; 7 else { 8 for (int i = flag; i; -- i) 9 cout << str << endl; 10 } 11 } 12 void…
【C++ Primer Plus】编程练习答案——第7章
1 double ch7_1_harmonicaverage(double a, double b) { 2 return 2 / (1 / a + 1 / b); 3 } 4 5 void ch7_1() { 6 using namespace std; 7 double a{0}, b{0}; 8 while (true) { 9 cout << "a: "; 10 cin >> a; 11 cout << "b: "; 12…
【C++ Primer Plus】编程练习答案——第6章
1 void ch6_1() { 2 using namespace std; 3 char ch; 4 while ((ch = cin.get()) != '@') { 5 if (isdigit(ch)) 6 continue; 7 else if (islower(ch)) 8 ch = toupper(ch); 9 else if (isupper(ch)) 10 ch = tolower(ch); 11 cout << ch; 12 } 13 } 14 15 void ch6_2(…
【C++ Primer Plus】编程练习答案——第5章
1 void ch5_1() { 2 using namespace std; 3 int small, big, sum{0}; 4 cout << "enter small and big: " << endl; 5 cout << "small: "; cin >> small; 6 cout << "big: "; cin >> big; 7 for (int i =…
【C++ Primer Plus】编程练习答案——第4章
1 void ch4_1() { 2 using namespace std; 3 string fname, lname; 4 char grade; 5 unsigned int age; 6 cout << "enter first name: "; 7 getline(cin, fname); 8 cout << "enter last name: "; 9 getline(cin, lname); 10 cout <<…
【C++ Primer Plus】编程练习答案——第3章
1 void ch3_1() { 2 using namespace std; 3 unsigned int factor = 12; 4 unsigned int inch, feet; 5 cout << "enter your height in inch:______\b\b\b\b\b\b"; 6 cin >> inch; 7 cout << inch / 12 << " feet and " <<…