7.8a
#include
using namespace std;
const int Seasons=4;
const char *season[Seasons]={“Spring”,”Summer”,”Fall”,”Winter”};
void fill(double *expenses);
void show(const double *);
void main78a()
{
double expenses[Seasons];
fill(expenses);
show(expenses);
system(“pause”);
}
void fill(double *expenses)
{
for(int i=0;i<Seasons;i++)
{
cout<<”\nEnter “<<*(season+i)<<” expenses:”;
cin>>*(expenses+i);
}
cout<<”Enter end!”;
}
void show(const double *arr)
{
cout<<”\nshow start!”<<endl;
for(int i=0;i<Seasons;i++)
{
cout<<”The “<<*(season+i)<<” expenses is “<<*(arr+i)<<endl;
}
cout<<”show endl”<<endl;
}
—————————————————————————————————————————————————— //写的错误或者不好的地方请多多指导,可以在下面留言或者给我发邮件,指出我的错误以及不足,以便我修改,更好的分享给大家,谢谢。 转载请注明出处:https://www.royalchen.com/ author:royalchen Email:royalchen@royalchen.com ———————————————————————————————————————————————————
- 本文作者: royalchen
- 本文链接: http://www.royalchen.com/2016/02/24/cprimerplus第六版课后编程题答案78a/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!