2.7练习题

//2.7编程练习

#include<iostream>


//1
/*
int main() {
	using namespace std;
	cout << "your name"<<endl;
	cout << "your address";
	cin.get();
	return 0;
}
*/

//2
/*
int LongToYard(int);
int main() {
	using namespace std;
	int Long;
	cout << "Please input the long :" << endl;
	cin >> Long;
	//int yard = LongToYard(Long);
	cout << "The " << Long << " longs are " << LongToYard(Long) << " yards .";
	cin.get();
	return 0;
}
int LongToYard(int n) {
	using namespace std;
	return n * 220;
}
*/

//3
/*
void Tbm();
void Shtr();
int main() {
	using namespace std;
	Tbm();
	Tbm();
	Shtr();
	Shtr();
	//cout << Tbm() << endl << Tbm() << endl << Shtr() << endl << Shtr() << endl;
	//这两个函数返回的是空值,cout无法进行输出
	return 0;
}
void Tbm() {
	using namespace std;
	cout << "Three blind mice" << endl;
	//cout << "Three blind mice" << endl;
}
void Shtr() {
	using namespace std;
	cout << "See how they run" << endl;
	//cout << "See how they run" << endl;
}
*/

//4
/*
int Month(int);
int main() {
	using namespace std;
	int year;
	cout << "Enter your age : ";
	cin >> year;
	cout << "Same as " << Month(year) << " months";
	return 0;
}
int Month(int n) {
	return n * 12;
}
*/

//5
/*
float cToF(float);
int main() {
	using namespace std;
	float Celsius;
	cout << "Please enter a Celsius value: ";
	cin >> Celsius;
	cout << endl << Celsius << " degrees Celsius is " << cToF(Celsius) << " degrees Fahrenheit.";
	return 0;
}
float cToF(float n) {
	return 1.8*n + 32.0f;
}
*/

//6
/*
int Change(float);
int main() {
	using namespace std;
	float year;
	cout << "Please enter the number of light years: ";
	cin >> year;
	cout <<endl<< year << " light years = " << Change(year) << " astronomical units.";
	return 0;
}
int Change(float n) {
	return n * 63240;
}
*/

//7
/*
void Time(int, int);
int main() {
	using namespace std;
	cout << "Enter the number of hours: ";
	int hour, minute;
	cin >> hour;
	cout << endl << "Enter the number of minutes: ";
	cin >> minute;
	Time(hour, minute);
	return 0;
}
void Time(int n, int m) {
	using namespace std;
	cout << "Time: " << n << ":" << m;
}
*/

 

转载于:https://my.oschina.net/Almon/blog/3034724

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值