输出国际象棋&&输出余弦曲线

输出国际象棋棋盘

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <windows.h>
 4 int main(){
 5     int i,j;
 6     SetConsoleOutputCP(437);//显示大于127的ASiic 码 
 7     for(i=0;i<8;i++){
 8         for(j=0;j<8;j++){
 9             if((i+j)%2==0 ){
10                 printf("%c%c",219,219);   //219号码代表国际象棋棋盘上的方块标  
11             }
12             else{
13                 printf("  ");
14             }    
15         }
16         printf("\n");
17     }
18     system("pause");
19     return 0;
20 }
21 
22 
23             

 

输出余弦曲线

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <math.h>
 4 
 5 int main(){
 6     double y;
 7     int x,m;
 8     for(y=1;y>=-1;y-=0.1){
 9         m=(int)(acos(y)*10);
10         for(x=0;x<m;x++) printf(" "); 
11         printf("*");
12         for(;x<62-m;x++) printf(" ");
13         printf("*\n"); 
14     }
15     system("pause");
16     return 0;
17 }

 

posted on 2015-09-18 20:53  逸阳  阅读(216)  评论(0编辑  收藏  举报

导航