4.2重学C++之【常见函数样式】
#include<iostream>
using namespace std;
/*
常见函数样式:
无参无返
有参无返
无参有返
无参无返
*/
// 1
void test1(){
cout << "this is test1" << endl;
}
// 2
void test2(int a){
cout << "this is test2 & a=" << a << endl;
}
// 3
int test3(){
cout << "this is test3" <<endl;
return 1000;
}
// 4
int test4(int a){
cout << "this is test4" <<endl;
return a*100;
}
int main(){
test1();
test2(6);
int num1 = test3();
cout << num1 << endl;
int num2 = test4(100);
cout << num2 << endl;
return 0;
}