3.
#include<iostream> using namespace std; int main() { char c1 = 'a', c2 = 'b', c3 = 'c', c4 = '101', c5 = '116'; cout << c1 << c2 << c3 << ' '; cout << " " << c4 << ' ' << c5 << ' '; return 0; }
结果:
4.
#include<iostream> using namespace std; int main() { char c1 = 'C', c2 = '+', c3 = '+'; cout << "I say: "" << c1 << c2 << c3 << '"'; cout << " " << "He says: "C++ is very interesting!"" << ' '; return 0; }
结果:
5.
(1). -72.5;
(2). 11.5;
(3). 23;
(4). a = b = c = 9;
(5). a = b = 6;
(6). a = 6, b = 5;
(7). 2.5;
(8). 3 or 3.5;
6.
a = 12;
a += a; 24
a -= 3; 9
a *=2 + 3; 60
a /=a + a; 0
a %=(n%=2); 0
a += a -= a *= a; 0
7.
#include<iostream> using namespace std; int main() { int i, j, m, n; i = 8; j = 10; m = ++i + j++; n = (++i) + (++j) + m; cout << i << ' ' << j << ' ' << m << ' ' << n << endl; return 0; }
结果:
8.
#include<iostream> using namespace std; int main() { char c1 = 'C', c2 = 'h', c3 = 'i', c4 = 'n', c5 = 'a'; int n = 4; c1 = c1 + n; c2 = c2 + n; c3 = c3 + n; c4 = c4 + n; c5 = c5 + n; cout << c1 << c2 << c3 << c4 << c5 << endl; return 0; }
结果: