有个c语言的问题,删除数组中所有相同的数字

[复制链接]
查看11 | 回复1 | 2007-11-23 13:40:29 | 显示全部楼层 |阅读模式
while((i<6)) printf("%d \n",a[i++]); 加个/n 输出了只是你没看到而已
回复

使用道具 举报

千问 | 2007-11-23 13:40:29 | 显示全部楼层
#include "stdio.h" int main(void ) { int a[6];int i,j;int ge = 0; int num = 6;printf("Please input 6 values(not input 0 : \n");for(i=0;i<6;i++) scanf("%d",&a); printf("What you have input is just like the numbers as follows:\n");for(i=0;i<6;i++) printf("%d\n",a);
i=0;while(i<num){j=i+1; while(j<num) {
if(a[j]==a)
{
for(ge = j; ge < 6; ge++)
a[ge]=a[ge+1];
num--; } else
j++;} i++;}printf("after correction,What you have input is just like the numbers as follows:\n"); i=0;while(i < num)printf("%d\n",a[i++]); return 0;}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行