主题:c++求解。。。。。。。。
#include<iostream>
#include<cctype>
using namespace std;
int fill_array(double a[],int n)
{
double hh;
int i=0,t=1;
cin>>hh;
while(!(isdigit(hh))&&t<=n)
{
a[i]=hh;
cin>>hh;
t++;
i++;
}
cout<<"you entered:"<<t-1<<"words"<<endl;
return 0;
}
int show_array(double q[],int n)
{
for(int i=0;i<=n-1;i++)
{
cout<<q[i]<<" ";
}
return 0;
}
int reverse_array(double a[],int n)
{
for(int i=0;i<n/2;i++)
{
double yy;
yy=a[n-i];
a[n-i]=a[i];
a[i]=yy;
}
return 0;
}
int main()
{
double fuck[10];
fill_array(fuck,10);
show_array(fuck,10);
cout<<endl;
reverse_array(fuck,10);
show_array(fuck,10);
cout<<endl;
return 0;
}运行出错;
#include<cctype>
using namespace std;
int fill_array(double a[],int n)
{
double hh;
int i=0,t=1;
cin>>hh;
while(!(isdigit(hh))&&t<=n)
{
a[i]=hh;
cin>>hh;
t++;
i++;
}
cout<<"you entered:"<<t-1<<"words"<<endl;
return 0;
}
int show_array(double q[],int n)
{
for(int i=0;i<=n-1;i++)
{
cout<<q[i]<<" ";
}
return 0;
}
int reverse_array(double a[],int n)
{
for(int i=0;i<n/2;i++)
{
double yy;
yy=a[n-i];
a[n-i]=a[i];
a[i]=yy;
}
return 0;
}
int main()
{
double fuck[10];
fill_array(fuck,10);
show_array(fuck,10);
cout<<endl;
reverse_array(fuck,10);
show_array(fuck,10);
cout<<endl;
return 0;
}运行出错;