zoukankan      html  css  js  c++  java
  • C语言练字用小软件 — Practise_Calligraphy_1.0(ANSI)

    //已收入以下版本

    1.Practise_Calligraphy_1.0
    2016.12.25
    *1.循环练各种字符
    *2.统计正确错误个数并输出正确率

    *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
    ",B1);
    		scanf("%s",a);
    		getchar();
    		blank((WID-strlen(B2))/2);
    		printf("%s
    ",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
    
    ");x++;}else
    				{printf("NO
    
    ");y++;}
    		}
    	//输出
    		star();
    		char w1[30],w2[30];
    		sprintf(w1,"OK,现在已经结束练习");
    		blank((WID-strlen(w1))/2);	
    		puts(w1);
    		//putchar('
    ');
    		sprintf(w2,"在刚刚的练习中,你对了%d个,错了%d个,你的正确率为%.2f%%",x,y,x*1.0/(x+y)*100);
    		blank((WID-strlen(w2))/2);	
    		puts(w2);
    		//putchar('
    ');	
    		star();
    		putchar('
    ');
    		putchar('
    ');
    		if(strcmp(s,"END2")==0)break;
    	}
    	return 0;
    }
    
    void star(){
    	int count;
    	for(count = 1; count <= WID; count++ ){
    		putchar('*');
    	}
    	putchar('
    ');
    }
    void blank(int q){
    	int count;
    	for(count = 1; count <= q; count++ ){
    		putchar(' ');
    	}
    }
    




  • 相关阅读:
    selenium获取Cookie操作
    分布式锁-常用技术方案
    合成模式(Composite)-结构型
    享元模式-结构型
    桥接模式-结构型
    适配器模式-结构型
    建造者模式-创建型
    单例和原型模式-创建型
    外观(门面)模式-结构型
    JDK QUEUE队列
  • 原文地址:https://www.cnblogs.com/gwj1314/p/9444978.html
Copyright © 2011-2022 走看看