VC++6.0这里运行一直是乱码怎么办? 这是一个把a{1,2,4,5,6}数组增加一个3进去,变成{1,2,3,4,5,6}
如图#include<stdio.h>intmain(){inta[6]={1,2,4,5,6};inti,m,n;for(i=0;i<5;i++)printf("%2d...
如图
#include <stdio.h>
int main()
{
int a[6]={1,2,4,5,6};
int i,m,n;
for (i=0;i<5;i++)
printf("%2d",a[i]);
printf("\n");
for (m=5;m>=3;m--)
a[m]=a[m-1];
a[2]=3;
for (n=0;n<=5;n++)
printf("%2d",a[6]);
printf("\n");
return 0;
}
运行结果
1 2 4 5 6
170380817038081703808170380817038081703808
Press any key to continue 展开
#include <stdio.h>
int main()
{
int a[6]={1,2,4,5,6};
int i,m,n;
for (i=0;i<5;i++)
printf("%2d",a[i]);
printf("\n");
for (m=5;m>=3;m--)
a[m]=a[m-1];
a[2]=3;
for (n=0;n<=5;n++)
printf("%2d",a[6]);
printf("\n");
return 0;
}
运行结果
1 2 4 5 6
170380817038081703808170380817038081703808
Press any key to continue 展开
1个回答
2017-10-24
展开全部
#include <stdio.h>
int main()
{
int a[6]={1,2,4,5,6};
int i,m,n;
for (i=0;i<5;i++)
printf("%2d",a[i]);
printf("\n");
for (m=5;m>=3;m--)
a[m]=a[m-1];
a[2]=3;
for (n=0;n<=5;n++)
printf("%2d",a[n]);
printf("\n");
return 0;
}
int main()
{
int a[6]={1,2,4,5,6};
int i,m,n;
for (i=0;i<5;i++)
printf("%2d",a[i]);
printf("\n");
for (m=5;m>=3;m--)
a[m]=a[m-1];
a[2]=3;
for (n=0;n<=5;n++)
printf("%2d",a[n]);
printf("\n");
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询