如题,我定义了一个数组ARRAY[20],其中数组的20个元素由键盘输入,cin>>ARRAY[20];是错误的,请问应该怎么输入呢?
第1个回答 2010-04-26
#include<iostream.h>
void main()
{
int ARRAY[20];
for (int k=0; k<=19;k++)
{
cin>>ARRAY[k];
}
}
void main()
{
int ARRAY[20];
for (int k=0; k<=19;k++)
{
cin>>ARRAY[k];
}
}
第2个回答 2020-06-14
Int ARRAY[20];
for(int n=0,n<20,n++)
Cin>>ARRAY[n];
//输入的数组下标应该比数组长度20小
for(int n=0,n<20,n++)
Cin>>ARRAY[n];
//输入的数组下标应该比数组长度20小
第3个回答 2020-06-15
#include<iostream>
using
namespace
std;
long
sa[10];
int
main()
{
freopen("in.txt","w",stdout);
for
(long
a=0;a<10;++a)
{
scanf("%d",&sa[a]);
printf("%d
",sa[a]);
}
freopen("out.txt","w",stdout);
for
(long
a=9;a>=0;--a)
printf("%d
",sa[a]);
}
using
namespace
std;
long
sa[10];
int
main()
{
freopen("in.txt","w",stdout);
for
(long
a=0;a<10;++a)
{
scanf("%d",&sa[a]);
printf("%d
",sa[a]);
}
freopen("out.txt","w",stdout);
for
(long
a=9;a>=0;--a)
printf("%d
",sa[a]);
}
第4个回答 2019-07-04
#include<iostream>
#include<string>
using namespace std;
int main() {
string a;
cin >> a;
return 0;
}
#include<string>
using namespace std;
int main() {
string a;
cin >> a;
return 0;
}
第5个回答 2010-04-26
用for循环输入啊