#include"iostream.h"enum day{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};void nextday(day &D);void display(day D);int main(){day today=Sunday;for(int i=0;i<7;i++){cout<<"Data in today="<<today<<endl;display(today);nextday(today);}return 0;}void nextday(day &D){switch(D){case Sunday:D=Monday;break;case Monday:D=Tuesday;break;case Tuesday:D=Wednesday;break;case Wednesday:D=Thursday;break;case Thursday:D=Friday;break;case Friday:D=Saturday;break;case Saturday:D=Sunday;break;}}void display(day D)// 请问这里为什么要写成(day D)为什么不能写成(day &D){switch(D){case Sunday:cout<<"Sunday"<<endl;break;case Monday:cout<<"Monday"<<endl;break;case Tuesday:cout<<"Tuesday"<<endl;break;case Wednesday:cout<<"Wednesday"<<endl;break;case Thursday:cout<<"Thursday"<<endl;break;case Friday:cout<<"Friday"<<endl;break;case Saturday:cout<<"Saturday"<<endl;break;}}
3 回答
- 3 回答
- 0 关注
- 103 浏览
添加回答
举报
0/150
提交
取消