| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 531 人关注过本帖
标题:[开源]分别输入的是数字还是非数字
只看楼主 加入收藏
sailer
Rank: 1
等 级:新手上路
帖 子:69
专家分:0
注 册:2005-10-12
收藏
 问题点数:0 回复次数:0 
[开源]分别输入的是数字还是非数字

我想用动态数组存放和比较大小后排序得到的有序数列。数组存放你想排列的数,数是从键盘输入。实现:当你输的不是数字时提示你,我打问号的地方就不太会了,请大家帮我补充。谢谢啊~!~!
最好是说明以下。





#include "alloc.h"
void bubblesort(int *list,int index)
{
int i,j,change,temp;
while(!change)
{
change=1;
for(j=index;j>0;j--)
{
for(i=0;i<j-1;i++)
{
if(list[i]<list[i+1])
{
temp=list[i];
list[i]=list[i+1];
list[i+1]=temp;
change=0;
printf("\n current sortting rest is:") ;
for(i=0;i<index;i++)
printf("%d",list[i]);
}
}
}
}
}

void main()
{
int []list=malloc(sizeoe(int)*n);
int i,index;
int node; /* 存储暂寸变量 */
char string;
printf("please enter the value of you want to sort:(数字)");
node=getch( ); ??????????
switch () ???????????
while(node!=string)
{
list[index]=node;
index=index+1;

}
bubblesort(list ,index);
printf("\n final sqrting rest is:");
for(i=0;i<index;i++)
{
printf("%d\t",list[i]);
}
}


搜索更多相关主题的帖子: 输入 开源 数字 
2005-11-29 22:27
快速回复:[开源]分别输入的是数字还是非数字
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.056495 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved