C++Primer第五版 第九章习题答案(51~52)

本文提供了C++Primer第五版第九章中关于栈适配器(stack)的习题解答,重点讲解了stack的pop()、push()和top()操作,以及其与queue和priority_queue的区别,强调了先进后出(LIFO)的原则。
摘要由CSDN通过智能技术生成

51:知识点:综合利用了之前的string的各项额外操作

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<vector>
#include<forward_list>
using namespace std;

class Date
{
public://class默认是私有继承,记得要加public
	unsigned _year;
	unsigned _month;
	unsigned _day;
	void _show()
	{
		cout<<_year<<"年"<<_month<<"月"<<_day<<"日"<<endl;
	}
	//构造函数
	Date(string);
};

Date::Date(string s)
{	
	int flag = 0;
	string number = "0123456789/";
	string coma = ",";
评论 27
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MISAYAONE

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值