随笔分类 -  c++

摘要:第一题: #include <iostream> #include <vector> #include <iterator> #include <string> using namespace std; bool huiwen(string input); int main() { string i 阅读全文
posted @ 2022-10-16 20:27 术术子 阅读(50) 评论(0) 推荐(0)
摘要:第一题: // base class class Cd { // represents a CD disk private: char performers[50]; char label[20]; int selections; // number of selections double pla 阅读全文
posted @ 2022-08-23 16:42 术术子 阅读(67) 评论(0) 推荐(0)
摘要:第一题 1. 对于下面的类声明: class Cow { char name[20]; char *hobby; double weight; public: Cow(); Cow(const char * nm, const char * ho, double wt); Cow(const Cow 阅读全文
posted @ 2022-08-18 16:07 术术子 阅读(87) 评论(0) 推荐(0)
摘要:第一题 vect.h: #ifndef VECTOR_H_ #define VECTOR_H_ #include <iostream> namespace VECTOR { class Vector { public: enum Mode {RECT, POL}; // RECT for recta 阅读全文
posted @ 2022-08-06 16:46 术术子 阅读(46) 评论(0) 推荐(0)
摘要:第一题: 为复习题5描述的类提供方法定义,并编写一个小程序来演示所有的特性: bank.h #ifndef BACK_H_ #define BACK_H_ #include <string> class Bankaccount { private: std::string accountname;/ 阅读全文
posted @ 2022-07-29 14:35 术术子 阅读(91) 评论(0) 推荐(0)
摘要:第一题 注意到setgolf()被重载,可以这样使用其第一个版本: golf ann; setgolf(ann, "Ann Birdfree", 24); 上述函数调用提供了存储在ann结构中的信息。可以这样使用其第二个版本: golf andy; setgolf(andy); 上述函数将提示用户输 阅读全文
posted @ 2022-07-22 14:12 术术子 阅读(65) 评论(0) 推荐(0)
摘要:第一题 : 1. 编写通常接受一个参数(字符串的地址),并打印该字符串的函数。然而,如果提供了第二个参数(int类型),且该参数不为0,则该函数打印字符串的次数将为该函数被调用的次数(注意,字符串的打印次数不等于第二个参数的值,而等于函数被调用的次数)。是的,这是一个非常可笑的函数,但它让您能够使用 阅读全文
posted @ 2022-07-11 15:41 术术子 阅读(105) 评论(0) 推荐(0)