摘要: if...else语句//实例4-2:密码程序#include "stdio.h"#include "conio.h"void main(){ int key; printf(" 密码程序\n\n"); printf("请输入密码:"); scanf("%d",&key); if (key==123) { printf("密码输入正确\a\n"); printf("欢迎使用本程序!\n"); } else printf("密码输入错误!\ 阅读全文
posted @ 2011-08-30 19:47 KeenLeung 阅读(1081) 评论(0) 推荐(0) 编辑
摘要: 格式化输出//实例3-5:格式化输出#include "stdio.h"#include "stdlib.h"//因为后面要用到toupper(字符),所以要在程序的头部使用语句"stdlib.h"进行包含#include "conio.h"void main(){ float PI=3.14159; int n; char ch; { printf("\t格式化输出\n"); printf("请输入一个小写字母:"); getch(); scanf("%c&quo 阅读全文
posted @ 2011-08-30 18:49 KeenLeung 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 格式化输入//实例3-1:计算圆的周长和面积#include "stdio.h"#include "conio.h"void main(){ float PI,r,c,s; PI=3.1415926; printf("请输入圆的半径:\n"); scanf("%f",&r); c=2*PI*r; s=PI*r*r; printf("半径为%.2f的圆的周长为:%.2f\n",r,c); printf("半径为%.2f的圆的面积为:%.2f\n",r,s); getch 阅读全文
posted @ 2011-08-30 16:43 KeenLeung 阅读(377) 评论(0) 推荐(0) 编辑