#include <iostream>
#include <climits>
using namespace std;
void ex1();
void ex2();
void ex3_1();
void ex3_2();
void ex4();
double ex5(double);
double ex6(double);
void ex7(int, int);
int main()
{
// using namespace std;
/* cout << "Come up and C++ me some time.";
cout << endl;
cout << "You won't regret it!" << endl;*/
// ex1();
// ex2();
/* ex3_1();
ex3_1();
ex3_2();
ex3_2();*/
// ex4();
/* double temp;
cout << "Please enter a Celsius value: ";
cin >> temp;
cout << endl << temp << " degrees Celsius is ";
temp = ex5(temp);
cout << temp << " degrees Fahrenheit." << endl;
cin.get();*/
/* double n;
cout << "Enter the number of light years: ";
cin >> n;
cout << endl << n;
n = ex6(n);
cout << " light years = " << n << " astronomical units." << endl;
cin.get();
cin.get();*/
/* int h, m;
cout << "Enter the number of hours: ";
cin >> h;
cout << endl << "Enter the number of minutes: ";
cin >> m;
cout << endl;
ex7(h, m);
cin.get();
cin.get();*/
int n_int = INT_MAX;
char alarm = '\a';
wchar_t bob = L'P';
cout << "int is " << sizeof (int) << " bytes" << endl;
cout << "int is " << sizeof n_int- 2<< "bytes" << endl;
cout << alarm<<alarm<<endl;
cout << '\u222b'<<endl ;
wcout << bob;
cin.get();
return 0;
}
void ex1()
{
cout << "姓名:雨珂" << endl << "地址:北京" << endl;
cin.get();
}
void ex2()
{
int n;
cout << "long:";
cin >> n;
cout << endl;
n = n * 220;
cout << "yard:" << n << endl;
cin.get();
cin.get();
}
void ex3_1()
{
cout << "Three blind mice" << endl;
}
void ex3_2()
{
cout << "See how they run" << endl;
}
void ex4()
{
int n;
cout << "Enter your age:";
cin >> n;
cout << endl;
n = n * 12;
cout << "month:" << n << endl;
}
double ex5(double n)
{
n = 1.8*n + 32;
return n;
}
double ex6(double n)
{
n = n * 63240;
return n;
}
void ex7(int h, int m)
{
cout << "Time: " << h << ":" << m << endl;
}
C++ Primer Plus第二章课后编程答案
最新推荐文章于 2019-10-12 09:56:56 发布