资源描述:
《c语言vc编程第一课河北工程大学何兴磊》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一.#includeintmain(){intmax(intx,inty);inta,b,c;printf("此程序用于比较两数的值的大小请输入两数(用空格键隔开)");scanf("%d%d",&a,&b);c=max(a,b);printf("max=%d",c);return0;}intmax(intx,inty){intz;if(x>y)z=x;elsez=y;return(z);}二.#includeintmain(){intmax(intx,inty
2、);inta,b,c;scanf("%d,%d",&a,&b);printf("max=%d",c);return0;}intmax(intx,inty){intz;if(x>y)z=x;elsez=y;return(z);}三.#include#include#includevoidmain(){charch;inti,sum=0;for(i=1;i<=100;i++)sum=sum+i;system("title程序-----作者:何兴磊"
3、);printf("%d",sum);ch=getch();}四.#include#includevoidmain(){printf("我爱你iloveyou");while(1)system("title我爱你");}五.#include#include#include#include#defineI20//爱心的上半部分两个小半圆的半径#defineR340//爱心的下半部分
4、圆弧曲线半径intmain(){inti,j,e;inta;//爱心的上半部分为两个实心半圆for(i=1,a=I;i0;j--)printf("");for(e=1;e<=2*sqrt((double)(I*I-(a-i)*(a-i)));e++)printf("3");for(j=(int)(2*(I-sqrt((double)(I*I-(a-i)*(a-i)))));j>0
5、;j--)printf("");for(e=1;e<=2*sqrt((double)(I*I-(a-i)*(a-i)));e++)printf("3");printf("");}//爱心的中间一行可以打印一些标记for(i=1;i<80;i++){if(i==25){printf("O(∩雨晨∩)O~ILOVEYOU!");i+=30;}printf("3");}printf("");//爱心的下半部分以R为半径的左右两条圆弧曲线R设置为比较大for(i=1;i<=R/2;i++){if(i%
6、2
7、
8、i%3)continue;//因为R很大两条曲线应该删去中间的一些点for(j=(int)(R-sqrt((double)(R*R-i*i)));j>0;j--)printf("");for(e=1;e<=2*(sqrt((double)(R*R-i*i))-(R-2*I));e++)printf("3");printf("");}system("title呵呵之表白");while(1){system("colora");Sleep(500);system("colorb");Sleep(5
9、00);system("colorc");Sleep(500);system("colord");Sleep(500);system("colore");Sleep(500);system("colorf");Sleep(500);system("color0");Sleep(500);system("color1");Sleep(500);system("color2");Sleep(500);system("color3");Sleep(500);system("color4");Sleep(500)
10、;system("color5");Sleep(1000);system("color6");Sleep(500);system("color7");Sleep(500);system("color8");Sleep(500);system("color9");Sleep(500);system("colorab");Sleep(500);system("colorac");Sleep(500);system("colorad