章1例题

来源:互联网 发布:天书世界披风数据 编辑:程序博客网 时间:2024/05/21 17:23
/*例1:显示 "HELLO WORLD"字符串*/#include <iostream>using namespace std;int main(){cout<<"HELLO WORLD"<<endl;return 0;}

/*例2:求最大数*/#include <iostream>using namespace std;int max(int x,int y){int t;if(x>y)t=x;if(y>x)t=y;return t;}int main(){int a,b,c;cout<<"请输入两个数:"<<endl;cin>>a>>b;c=max(a,b);cout<<"最大数是:"<<c<<endl;return 0;}


0 0
原创粉丝点击