1-3 数组的反序输出
Time Limit: 1000MS
Memory Limit: 65536KB
Problem Description
C++中数组的输入输出方法。
10个int型数组中,而后再按与输入相反的顺序输出这些数据
Input
输出内容共Enter numbers(10 int)
---Reverse output---
<p class="\"cjk\"" 0.74cm;="" margin-bottom:="" 0cm\"="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 3px;">第三行输出反序后的内容:顺序与输入顺序相反,每个数之间用一个空格间隔。Example Input
12 45 56 23 89 78 25 14 36 69
Example Output
Enter numbers(10 int) ---Reverse output--- 69 36 14 25 78 89 23 56 45 12
Code realization
#include <iostream>
using namespace std;
int main()
{
int a[10],i;
for(i=0;i<10;i++)
cin>>a[i];
cout<<"Enter numbers(10 int)"<<endl;
cout<<"---Reverse output---"<<endl;
for(i=9;i>=0;i--)
{
cout<<a[i];
if(i>0)
cout<<" ";
}
return 0;
}