c++ primer plus 第四章 课后题答案】的更多相关文章

#include<iostream> #include<string> using namespace std; int main() { string first_name; string last_name; char grade; int age; cout << "What is your first name? "; getline(cin,first_name); cout << endl << "Wha…
#include <iostream> using namespace std; double HAR_AVG(double, double); void TEST(bool); int main() { double x, y; cout << "Please enter two values(encountered zero end):\n"; cin >> x; TEST(cin.fail()); cin >> y; TEST(ci…
#include <iostream> #include <cctype> using namespace std; int main() { char in_put; do { cout << "Please enter the letters (enter @ exit):"; cin >> in_put; if (islower(in_put)) cout << "The uppercase of the le…
#include <iostream> using namespace std; int main() { ; cout << "Please enter two number: "; cin >> num_1; cin >> num_2; if (num_1 > num_2) { int a; a = num_1; num_1 = num_2; num_2 = a; } for (int i = num_1; i <= nu…
#include<iostream> using namespace std; int main() { ; int shen_gao; cout <<"Please enter your leight in inches:____\b\b\b"; cin >> shen_gao; cout << "It is contains: " << shen_gao / unit << " f…
#include<iostream> using namespace std; int main() { cout << "My name is Jiantong Chen." << endl << "I'm a student in the Xi'an University."; cin.get(); ; } #include<iostream> using namespace std; int main…
2.5 习题 2.1 数据寄存器 1. 八个通用寄存器除了各自规定的专门用途外,它们均可以用于传送和暂存数据,可以保存算术逻辑运算中的各种操作数和运算结果. 2.1 AX和Al寄存器又称为累加器(accumulate).一般通过累加器进行的操作所花的时间可能最少,此外,累加器还有许多专门的用途,所以累加器使用的十分普遍. 2.2 BX寄存器称为基(bsae)地址寄存器.它是四个数据寄存器中唯一可作为存储器指针使用的寄存器. 2.3 CX寄存器称为计数(count)寄存器.在字符串操作和循环操作时…
5-8Geometry import math def sqcube(): s = float(raw_input('enter length of one side: ')) print 'the area is:', s ** 2., '(units squared)' print 'the volume is:', s ** 3., '(cubic units)'def cirsph(): r = float(raw_input('enter length of radius: ')) p…
4-1Python objects All Python objects have three attributes:type,ID,and value. All are readonly with a possible expection of the value(which can be changed only if the object is mutable). 4-5str()and repr() repr() is a built-in function while str() wa…
3-4Statements Ues ; 3-5Statements Use\(unless part of a comma-separated sequence in which case \ is optional)…