菜单技术
来源:互联网 发布:linux定时任务每15分钟 编辑:程序博客网 时间:2024/05/16 09:58
<span style="font-size:18px;">#include <stdio.h>#include <stdlib.h>char get_choice(void);char get_first(void);int get_int(void);void count(void);int main(void){ int choice; while((choice = get_choice())!='q') { switch(choice) { case 'a': printf("Buy low,sell high.\n"); break; case 'b': putchar('\a'); break; case 'c': count(); break; default: printf("Program error!\n"); break; } } printf("Bye!\n"); return 0;}void count (void){ int n,i; printf("Count how far ? Enter integer:\n"); n = get_int(); for( i = 0; i < n ; i++) { printf("%d\n",i); } while(getchar()!='\n') continue;}char get_choice(void){ int ch; printf("Enter the letter of your choice:\n"); printf("a.advice b.bell\n"); printf("c.count d.quit\n"); ch = get_first(); while(((ch < 'a')||ch >'c') && ch != 'q') { printf("Please respond with a,b,c,d,and q.\n"); ch = get_first(); } return ch;}char get_first(void){ int ch; ch = getchar(); while(getchar() != '\n') continue; return ch;}int get_int(void){ int input; char ch; while(scanf("%d",&input) != 1) { while((ch = getchar())!='\n') putchar(ch);<span style="white-space:pre"></span>/* 剔除错误的输入 */ printf(" is not an integer.\n Please enter an integer value,such as 25,-178,or 3:"); } return input;}</span>
0 0
- 菜单技术
- 滑动门菜单技术
- MENU 菜单技术详解
- Ajax技术实现树菜单
- javascript实现浏览器菜单技术
- Windows-菜单编程基本技术
- ajax技术初探实现连动菜单
- 运用ajax技术的树型菜单
- 运用ajax技术的树型菜单
- 运用ajax技术的树型菜单
- 运用ajax技术的树型菜单
- CSSDIVJavascript制作滑动门菜单技术
- Ajax技术实现级联菜单项
- 滑动菜单及滑动解锁技术分析
- 滑动菜单及滑动解锁技术分析
- 滑动菜单及滑动解锁技术分析
- Excel技术--多级关联菜单相关(MATCH)
- 实现二级联动菜单的技术细节
- .net 中的托管与非托管
- ActiveMQ入门实例
- 黑马程序员--IOS_学习笔记_UIView\UIViewControler
- 黄明:行为金融学和量化投资的应用
- Gerrit+apache+H2数据库简单安装配置及建库流程
- 菜单技术
- 第16周项目2-用指针玩字符串(5)
- Linux进程间通信之管道(pipe)、命名管道(FIFO)与信号(Signal)
- combotree 多选赋值
- android ListView 上拉下拉变黑解决办法。
- 如何正确的make menuconfig
- Extjs重写
- YII对象结果转为数组或直接输入JSON格式
- 记一次使用eclemma的蛋疼的测试经历