C语言练字用小软件 — Practise_Calligraphy_1.0(ANSI)
【摘要】
//已收入以下版本 1.Practise_Calligraphy_1.0
2016.12.25
*1.循环练各种字符
*2.统计正确错误个数并输出正确率
*3.简洁清晰的命令行GUI界面
//请采用ANSI等支持中文的编码方式进行编译//@面码什么的最喜欢了 2016.12.25#include<st...
//已收入以下版本
*3.简洁清晰的命令行GUI界面
-
//请采用ANSI等支持中文的编码方式进行编译
-
//@面码什么的最喜欢了 2016.12.25
-
#include<stdio.h>
-
#include<string.h>
-
#define WID 80
-
#define B1 "请输入要练的字符"
-
#define B2 "OK,你现在正在练习的字符是(输入END以结束)"
-
void star();//打印星星
-
void blank(int q);//打印空空
-
int main(){
-
while(1){
-
char s[20],a[20];
-
int x=0,y=0;
-
//输入
-
star();
-
blank((WID-strlen(B1))/2);
-
printf("%s\n",B1);
-
scanf("%s",a);
-
getchar();
-
blank((WID-strlen(B2))/2);
-
printf("%s\n",B2);
-
blank((WID-strlen(a))/2);
-
puts(a);
-
star();
-
//练字
-
while(1){
-
gets(s);
-
if(strcmp(s,"END")==0)break;
-
if(strcmp(s,"END2")==0)break;
-
if(strcmp(s,a)==0){printf("YES\n\n");x++;}else
-
{printf("NO\n\n");y++;}
-
}
-
//输出
-
star();
-
char w1[30],w2[30];
-
sprintf(w1,"OK,现在已经结束练习");
-
blank((WID-strlen(w1))/2);
-
puts(w1);
-
//putchar('\n');
-
sprintf(w2,"在刚刚的练习中,你对了%d个,错了%d个,你的正确率为%.2f%%",x,y,x*1.0/(x+y)*100);
-
blank((WID-strlen(w2))/2);
-
puts(w2);
-
//putchar('\n');
-
star();
-
putchar('\n');
-
putchar('\n');
-
if(strcmp(s,"END2")==0)break;
-
}
-
return 0;
-
}
-
-
void star(){
-
int count;
-
for(count = 1; count <= WID; count++ ){
-
putchar('*');
-
}
-
putchar('\n');
-
}
-
void blank(int q){
-
int count;
-
for(count = 1; count <= q; count++ ){
-
putchar(' ');
-
}
-
}

文章来源: gwj1314.blog.csdn.net,作者:小哈里,版权归原作者所有,如需转载,请联系作者。
原文链接:gwj1314.blog.csdn.net/article/details/54744094
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)