![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++ primer 学习
Turboooooo
这个作者很懒,什么都没留下…
展开
-
第五章习题
第五章习题7、写出下列程序的运行结果。#include <iostream> using namespace std;class A{public: A(int i) : x(i) {} A() { x = 0; } friend A operator++(A a); friend A operator--(A &a); void print();private: int x;};A operator++(A a)原创 2021-06-20 23:31:54 · 403 阅读 · 0 评论 -
C++第四章习题
C++第四章习题写出下面程序的运行结果。#include <iostream>using namespace std;class B1 { public:B1(int i) { b1=i; cout<<”constructor B1.”<<endl; }void Print( ) { cout<<b1<<endl; } private:int b1;};class B2 {public:B2(int i) { b原创 2021-06-20 23:28:28 · 2254 阅读 · 1 评论 -
C++第三章习题
C++第三章习题写出程序的运行结果:#include <iostream>using namespace std;class toy{public: toy(int q, int p) { quan = q; price = p; } int get_quan() { return quan; } int get_price() { return price; }private: int quan原创 2021-06-20 20:59:27 · 1705 阅读 · 1 评论 -
第二章.字符串功能练习
实现功能按照提示输入单个字符串,把输入的字符串连接后输出。#include<iostream>#include <string>using namespace std;int main(){ string s, result; char cont = 'y' ; while ( cin >> s ) { if ( ! result. size()) { result += s; }原创 2021-04-11 16:35:46 · 103 阅读 · 0 评论 -
第一章.书店程序
实现功能:输入一组书店的销售记录,包括书的isdn号,销售数量,售出单价。输出同一isdn书籍的合并销售记录。对前面类的定义是复制其他博主的。#include <iostream>#include <string>#include <cassert>#include <algorithm>#include <vector>using namespace std;class Sales_data{ friend std::原创 2021-04-11 14:14:24 · 190 阅读 · 0 评论