看代码就好了,很简单
#include <iostream>
using namespace std;
/*第三题定义的函数*/
void out1() {
cout << "Three blind mice" << endl;
}
void out2() {
cout << "see how they run" << endl;
}
void display(int h, int m);
double huashi(double tem);
int main() {
/*
1.编写一个c++程序,它显示您的姓名和地址
*/
/*cout << "name:" << "Cuit小唐" << endl << "地址:" << "Cuit";
return 0;*/
/*
2.要求用户输入一个以long为单位的距离,然后将它转换为码(一 long 等于 220 码)
*/
/*int long1;
cout << "请输入距离:" << endl;
cin >> long1;
long1 = long1 * 220;*/
/*
3.使用3个用户定义的函数(包括main()),并生成下面的输出:
Three blind mice
Three blind mice
see how they run
see how they run
分别调用两次
*/
//out1();
//out1();
//out2();
//out2();
/*编写一个程序,让用户输入其年龄,然后显示这个年龄包含多少个月*/
//int age,month;
//cout << "Enter your age:";
//cin >> age;
//month = 12 * age;
//cout << "Your age in months is " << month;
/*
5.main调用一个用户自定义函数(以摄氏温度值为参数,并返回相应的华氏度温度值)
华氏温度 = 1.8 * 摄氏度 + 32.0 */
/*double tem,hua;
cin >> tem;
hua = huashi(tem);
cout << hua;*/
/*6.编写函数用户输入小时数和分钟数,将两个值传给void 函数并且输出到控制台*/
int h, m;
cin >> h >> m;
display(h, m);
}
/*第五题定义的函数*/
double huashi(double tem) {
double con;
return con = tem * 1.8 + 32.0;
}
/*6*/
void display(int h, int m) {
cout << h << ":" << m;
}