有一个c语言程序题,求怎么把这四个字打乱并做解析? 110
#include<stdio.h>#include<stdlib.h>intmain(){inta[4]={4,1,3,2};inti,j;for(i=1;i<4;i){...
#include <stdio.h>
#include <stdlib.h>
int main( )
{
int a[4] = {4,1,3,2};
int i,j;
for (i = 1; i <4; i )
{
int temp = a[i];
for (j = i - 1; j >= 0 && a[j] > temp; j--)
{
a[j 1] = a[j];
}
a[j 1] = temp;
}
for ( i = 0; i < 4; i )
{
if(a[i]==1)
printf("好 ");
if(a[i]==2)
printf("好 ");
if(a[i]==3)
printf("学 ");
if(a[i]==4)
printf("习 ");
}
printf("\n");
system("pause");
}
打乱“好好学习”这四个字的顺序 展开
#include <stdlib.h>
int main( )
{
int a[4] = {4,1,3,2};
int i,j;
for (i = 1; i <4; i )
{
int temp = a[i];
for (j = i - 1; j >= 0 && a[j] > temp; j--)
{
a[j 1] = a[j];
}
a[j 1] = temp;
}
for ( i = 0; i < 4; i )
{
if(a[i]==1)
printf("好 ");
if(a[i]==2)
printf("好 ");
if(a[i]==3)
printf("学 ");
if(a[i]==4)
printf("习 ");
}
printf("\n");
system("pause");
}
打乱“好好学习”这四个字的顺序 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询