64,647
社区成员
发帖
与我相关
我的任务
分享
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
#define x 9
//int fill_array(double ar[],int limit);
int fill_array(double ar[],int limit)
{
/*
double temp;
int i;
for(i=0; i<temp; i++)
{
cout<<"EnterA"<<i+1<<":";
cin>>temp;
if(!cin)
{
cin.clear();
while(cin.get()!='\n')
continue;
cout<<"Bad input /n";
break;
}
else if(temp<0)
break;
// ar[i]=temp;
}
cout<<i<<endl;
*/
for(int i=0;i<9;i++)
cout<<ar[i]<<endl;
return ar[1];
}
int main()
{
double ar[x]= {1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5};
int limit=9;
cout<<fill_array(ar,limit);
}