首页 > 其他 > 详细

两个高级编程实例

时间:2015-09-18 21:38:49      阅读:193      评论:0      收藏:0      [点我收藏+]

输出国际象棋棋盘

 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 }

 

两个高级编程实例

原文:http://www.cnblogs.com/liugl7/p/4820315.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!