c语言中如何按键esc 退出,C語言 怎么案ESC鍵回原問題

当前位置:我的异常网» C语言 » C語言 怎么案ESC鍵回原問題

C語言 怎么案ESC鍵回原問題

www.myexceptions.net  网友分享于:2013-03-04  浏览:43次

C語言 如何案ESC鍵回原問題

這是一道先乘除後加減的編程(按下 '= '鍵會算出答案)

題目:

在按下 '= '鍵之前   按下 'ESC '   會回到原題目

在算出答案後   按任何建繼續   按 'ESC '回中程序

不知道哪為大大可以幫我改一下

以下是先乘除後加減的編程   要把它加上題目說的

#include  

#include  

//prototypes

char   GetInteger(int*   x);

int   main(int   argc,   char   *argv[])

{

//declare   variables

char   state;                 //to   the   state   of   the   state   machine

int   x,   x1,   x2,   x3,   result;

char   op,   op1;

int   repeat;

//explain   the   program

printf( "Welcome   to   the   single-digit   calculator   ");

printf( "with   multiplication.\n\n ");

state   =   'F ';         //enter   state   F   initially

repeat   =   'y ';       //enter   the   loop   initially

while(repeat   ==   'y '   ||   repeat   ==   'Y ')

{

switch(state)

{

case   'F ':

//state   F:   prompt   user   for   input

//and   leave   for   state   A   unconditional

printf( "Please   input   the   equation:\n ");

state   =   'A ';       //update   the   state

break;

case   'A ':

case   'B ':

//op,x  

//and   leave   for   state   C   on   op1=op;   x1=x

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值