题目:
填空题
在下面程序横线处填上适当字句,使该程序执行结果为反向输出数组的元素:
50, 40, 30, 20, 10
0, 7.5, 8.4, 9.3, 10.2, 11.1
#include
using namespace std;
template
void fun( )
{ ;
for( int i=0; i{ t=a[i]; a[i]=a[n-1-i]; a[n-1-i]=t; }
}
int main( )
{ int i,a[5]={10, 20, 30, 40, 50};
double d[6]={11.1, 10.2, 9.3, 8.4, 7.5};
fun(a, 5); fun(d, 6);
for ( i=0; i<5; i++) cout << a[i] << ",";
cout <<endl;
for ( i=0; i<6; i++) cout << d[i] << ",";
cout << endl; }
答案:
<查看本题扣1积分>