将数字0~19存入一个整型数组a中(即a[0]=0……a[19]=19),然后再逆序输出
时间: 2023-12-26 09:06:11 浏览: 57
Sure, here's the code to store the numbers 0 ~ 19 in an integer array "a" and then print them out in reverse order:
```c++
#include <iostream>
using namespace std;
int main() {
int a[20]; // declare an integer array with size 20
for (int i = 0; i < 20; i++) {
a[i] = i; // store the numbers 0 ~ 19 in the array
}
// print out the array in reverse order
for (int i = 19; i >= 0; i--) {
cout << a[i] << " ";
}
cout << endl;
return 0;
}
```
Hope this helps!
阅读全文