当前位置: 代码迷 >> C语言 >> 程序退出的问题,大家给看看啊
  详细解决方案

程序退出的问题,大家给看看啊

热度:295   发布时间:2007-07-15 12:11:31.0
程序退出的问题,大家给看看啊

#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  

----------------解决方案--------------------------------------------------------
#include<graphics.h>
这是不可移植的!

----------------解决方案--------------------------------------------------------

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


----------------解决方案--------------------------------------------------------
  相关解决方案