C++primer plus第二章练习题

#include 

using namespace std;

int main(){
	cout<<"姓名:第三天"<<endl;
	cout<<"居住地:中国苏州"<<endl;

	system("pause");
	return 0;
}
#include 

using namespace std;

int main(){
	int _long;
	int ma;
	cout<<"请输入一个以long为距离的单位:";
	cin>>_long;

	ma = _long * 220;

	cout<<"共有"<<ma<<"码"<<endl;

	system("pause");
	return 0;
}
#include 

using namespace std;

void s1(){
	cout<<"Three blind mice"<<endl;
}

void s2(){
	cout<<"See how they run"<<endl;
}
int main(){
	s1();
	s1();
	s2();
	s2();
	system("pause");
	return 0;
}
#include 

using namespace std;

int main(){
	int age;
	int mounth;
	cout<<"Enter your age:";
	cin>>age;

	mounth = age * 12;

	cout<<age<<"岁包含"<<mounth<<"个月"<<endl;

	system("pause");
	return 0;
}
#include 

using namespace std;

double change(double celsius){

	return 1.8 *celsius +32.0;
}
int main(){
	double celsius;

	cout<<"please enter a celsius value:"<<endl;
	cin>>celsius;
	cout<<celsius<<" degrees celsius is "<<change(celsius)<<" degrees Fahrenheit."<<endl;;

	system("pause");
	return 0;
}
#include 

using namespace std;

double change(double year){
	return year * 63240;
}

int main(){
	double year;

	cout<<"请输入光年值:";
	cin>>year;
	cout<<"转化成华氏度后:"<<change(year)<<endl;;

	system("pause");
	return 0;
}
#include 

using namespace std;

void change(int hours,int minutes){
		cout<<"Time:"<<hours<<":"<<minutes<<endl;
}
int main(){
	int hours,minutes;

	cout<<"Enter the number of hours:";
	cin>>hours;
	cout<<"Enter the number of minutes:";
	cin>>minutes;
	
	change(hours,minutes);

	system("pause");
	return 0;
}

你可能感兴趣的:(C++,primer,plus第6版练习题答案)