ITPub博客

首页 > 应用开发 > > 为什么这段代码打出来是空的?与书上运行结果不一样?

为什么这段代码打出来是空的?与书上运行结果不一样?

作者:hawkliu 时间:2019-08-05 09:19:43 0 删除 编辑
/* Note:Your choice is C IDE */

#include "stdio.h"

#define N 30

void main()

{

 int i,j,temp,a[N];

 printf("Please input class scores:\n");

for(i=0;i<N;i++)

scanf("%d",&a[i]);

 for(j=i+1;j<N-1;j++)

  for(j=i+1;j<N;j++)

   if(a[i]<a[j])

   {

   temp=a[i];

   a[i]=a[j];

   a[j]=temp;

   }

   printf("class scores other:");

   for(i=0;i<N;i++)

   {

   if(i%6==0)

    printf("\n");

     printf("%3d",a[i]);

   }   

}


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/887/viewspace-3125688/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-29

  • 博文量
    274
  • 访问量
    1129