首页 编程C/C++函数的返回值,参数与变量

函数的返回值,参数与变量

#include <iostream>
using namespace std;
void show()  
{
 cout<<“Hello Worldn”;
}//该函数没有返回值
int show1(int x,int y)    //int x & int y 是参数
{
 return x+y;    //return返回了x+y的值
}//返回值类型为int
int main()
{
 show();
 int a,b;
 cout<<“请输入两个整数:”;
 cin>>a;
 cin>>b;
 cout<<“a+b=”<<show1(a,b)<<endl;    //a & b是变量,大小取决于用户的输入
 return 0;
}