主题:帮我纠正错误,谢谢
源文件代码:
#include <iostream>
using namespace std;
double* Fill_array(double arr[], int);
void Reverse_array(double*, double*);
int main()
{
const int ArSize=10;
double* arrend;
double arr[ArSize];
arrend=Fill_array(arr, ArSize);
Reverse_array(arr, arrend);
cin.get();
return 0;
}
double* Fill_array(double arr[], int size)
{
int counts=0;
cout<<"请输入double型数据,以空格分开:\n ";
while(counts<size && cin>>arr[counts])
counts++;
return &arr[counts];
}
void Reverse_array(double* start, double* end) [color=FF0000]//这个函数里的代码有问题,无法正确输出反转后的数组,谢帮我改改,谢谢[/color]{
double tmpdata;
for(; start!=end; start++, end--)
{
tmpdata=*start;
*start=*end;
*end=tmpdata;
cout<<*start<<endl;
}
cout<<"反转后的数据为: ";
for(; start!=end; start++)
cout<<*start<<" ";
cout<<"\n\n";
}
#include <iostream>
using namespace std;
double* Fill_array(double arr[], int);
void Reverse_array(double*, double*);
int main()
{
const int ArSize=10;
double* arrend;
double arr[ArSize];
arrend=Fill_array(arr, ArSize);
Reverse_array(arr, arrend);
cin.get();
return 0;
}
double* Fill_array(double arr[], int size)
{
int counts=0;
cout<<"请输入double型数据,以空格分开:\n ";
while(counts<size && cin>>arr[counts])
counts++;
return &arr[counts];
}
void Reverse_array(double* start, double* end) [color=FF0000]//这个函数里的代码有问题,无法正确输出反转后的数组,谢帮我改改,谢谢[/color]{
double tmpdata;
for(; start!=end; start++, end--)
{
tmpdata=*start;
*start=*end;
*end=tmpdata;
cout<<*start<<endl;
}
cout<<"反转后的数据为: ";
for(; start!=end; start++)
cout<<*start<<" ";
cout<<"\n\n";
}

您所在位置: