一
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[3];
cin >> a[0];
cin >> a[1];
cin >> a[2];
cout << a[0] << endl;
cout << a[1] << endl;
cout << a[2] << endl;
return 0;
}
二
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[11] , i = 1;;
while(i < 11){
cin >> a[i];
i = i + 1;
}
i = 1;
while(i < 11){
cout << a[i] << endl;
i = i + 1;
}
return 0;
}
三
分别赋值
int a[5] = {1 , 2 , 3 , 4 , 5};
部分赋值
int a[5] = {1 , 2 , 3}; //a[0] == 1 , a[1] == 2 , a[2] == 3 , 其余不变
清零数组
int a[5] = {0}; //a[0] == 0 , a[1] == 0 , a[2] == 0 , a[3] == 0 , a[4] == 0 ,
标签:11,std,一维,int,cin,数组,main
From: https://www.cnblogs.com/hnzzlxs01/p/16655863.html