7.8

#include<iostream>

using std::cin;
using std::cout;
using std::endl;

const int	Seasons =4;
struct jidu{
	double expenses;
};

const char* Snames[4]={"spring","summer","fall","winter"};
void fill(double *pa,int number);
void show(double *pa,int number);
void fill(jidu b[],int number);
void show(jidu b[],int number);
int main()
{
	jidu a[4] ;
	fill(a,4);
	show(a,4);
	double expenses[4];
	fill(expenses,4);
	show(expenses,4);
	system("pause");
	return 0;
}
void fill(jidu a[],int number)
{
	for(int i=0;i<4; i++)
	{
		cout<<"enter: "<<Snames[i]<<" expenses : ";
		cin>>a[i].expenses;
	}
}
void show(jidu a[],int number)
{
	for(int i=0;i<number;i++)
	{
		cout<<"enter: "<<Snames[i]<<" expenses : ";
		cout<<a[i].expenses<<endl;
	}
}
void fill(double *pa,int number)
{
	for(int i=0;i<4;i++)
	{
		cout<<"enter: "<<Snames[i]<<" expenses : ";
		cin>>pa[i];
	}
}
void show (double*pa,int number)
{
for(int i=0;i<4;i++)
	{
		cout<<"enter: "<<Snames[i]<<" expenses : ";
		cout<<pa[i]<<endl;
	}
}

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭