C++初学者,遇到的问题,不知道哪里出错了,详情如下:
#include<iostream>usingnamespacestd;intmain(){inti;intj;intt;inta[11];cout<<"inputten...
#include<iostream>
using namespace std;
int main()
{
int i;
int j;
int t;
int a[11];
cout<<"input ten numbers:"<<endl;
for(i=1;i<=10;i++)
cin>>a[i];
cout<<endl;
for(j=1;j<=9;j++)
for(i=1;i<=10;i++)
if(a[i]>a[i+1])
{
t=a[i];a[i]=a=[i+1];a[i+1]=t;
}
cout<<"the sorted numbers:"<<endl;
for(i=1;i<11;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
错误:
错误 1 error C2059: 语法错误 : “[” e:\user_data\visual studio 2005\projects\test1.3\test1.3\test1.3.1.cpp 17 展开
using namespace std;
int main()
{
int i;
int j;
int t;
int a[11];
cout<<"input ten numbers:"<<endl;
for(i=1;i<=10;i++)
cin>>a[i];
cout<<endl;
for(j=1;j<=9;j++)
for(i=1;i<=10;i++)
if(a[i]>a[i+1])
{
t=a[i];a[i]=a=[i+1];a[i+1]=t;
}
cout<<"the sorted numbers:"<<endl;
for(i=1;i<11;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
错误:
错误 1 error C2059: 语法错误 : “[” e:\user_data\visual studio 2005\projects\test1.3\test1.3\test1.3.1.cpp 17 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询