| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 436 人关注过本帖
标题:程序退出的问题,大家给看看啊
只看楼主 加入收藏
雀吟
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-7-13
收藏
 问题点数:0 回复次数:2 
程序退出的问题,大家给看看啊

#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>


main()
{


void two(void);
void eight(void);
void ten(void);
void sixteen(void);
int i,num;


while(1)
{


printf("\n");

printf(" ******************************\n");
printf(" *** please choose a system ***\n");
printf(" ******************************\n");

printf(" 0.exit\t\t **EXIT** \n 1.TWO\t\t ** 2 ** \n 2.EIGHT\t\t ** 8 ** \n 3.TEN\t\t ** 10 ** \n 4.SIXTEEN\t\t ** 16 **\n");
printf("\n");
printf(" please choose a system:");
scanf("%d",&i);

switch(i)
{

case 1 : two(); break;
case 2 : eight(); break;
case 3 : ten(); break;
case 4 : sixteen(); break;
default : printf("\n");
printf(" you insert a wrong number!\n");
break;
}
}
}

void two(void)
{
int n;
char buf[32];
printf(" PLEASE ENTER A NUMBER OF SYSTEM 2:");
scanf("%S",&n);
itoa(n, buf, 10);
printf(" CHANGE TO SYSTEM 10:%s\n",buf);
itoa(n, buf, 8);
printf(" CHANGE TO SYSTEM 8:%s\n",buf);
itoa(n, buf, 16);
printf(" CHANGE TO SYSTEM 16:%s\n",buf);
}

void eight(void)
{
int n;
char buf[32];
printf(" PLEASE ENTER A NUMBER OF SYSTEM 8:");
scanf("%o",&n);
itoa(n, buf, 10);
printf(" CHANGE TO SYSTEM 10:%s\n",buf);
itoa(n, buf, 2);
printf(" CHANGE TO SYSTEM 2:%s\n",buf);
itoa(n, buf, 16);
printf(" CHANGE TO SYSTEM 16:%s\n",buf);
}

void ten(void)
{
int n;
char buf[32];
printf(" PLEASE ENTER A NUMBER OF SYSTEM 10:");
scanf("%d",&n);
itoa(n, buf, 16);
printf(" CHANGE TO SYSTEM 16:%s\n",buf);
itoa(n, buf, 8);
printf(" CHANGE TO SYSTEM 8:%s\n",buf);
itoa(n, buf, 2);
printf(" CHANGE TO SYSTEM 2:%s\n",buf);
}

void sixteen(void)
{
int n;
char buf[32];
printf(" PLEASE ENTER A NUMBER OF SYSTEM 16:");
scanf("%x",&n);
itoa(n, buf, 10);
printf(" CHANGE TO SYSTEM 10:%s\n",buf);
itoa(n, buf, 8);
printf(" CHANGE TO SYSTEM 8:%s\n",buf);
itoa(n, buf, 2);
printf(" CHANGE TO SYSTEM 2:%s\n",buf);
}


这是一个进制转换的程序,问题是:不能退出...还有怎么换字体颜色啊,..


搜索更多相关主题的帖子: void printf include 
2007-07-15 12:11
yohji
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-7-14
收藏
得分:0 
#include<graphics.h>
这是不可移植的!

http:///
2007-07-15 12:23
雀吟
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-7-13
收藏
得分:0 

问题不是在那里的啊...

2007-07-15 15:08
快速回复:程序退出的问题,大家给看看啊
数据加载中...
 
   



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

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