我在班级生日中的 switch 语句有问题,为什么我不能在班级中放置 switch?我尝试解决但我不能,我使用 Visual Studio 2017
#include<string>
#include<iostream>
using namespace std;
class Birthday {
public:
Birthday(int d,int m,int y)
:day(d),month(m),year(y)
{
}
void printBirth() {
cout << month << " " << day << " " << year << endl;
}
private:
int day, month, year;
string month_name;
switch (month)
{
case 1:
month_name = "January"
break;
default:
month = "None";
break;
}
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句