Today, some people do it, some topics are relatively representative, and all the answers are all posted, and give a reference to friends needed. All procedures are commissioned in the Visual C 6.0 environment. If you have a better answer method for some of the programs, you are welcome to exchange. Because of the limited time, no write comments, if you don't understand it, you can also follow. First, the extension of the C source program file is: AA) .cpp b) .c c) .dll d) .EXE2, assignment lowercase letters n to character variables one_char, the correct operation is: CA) One_char = '/ n'; b) One_char = "n"; c) One_CHAR = 110; D) One_CHAR = 'N'; 3, the result of the initial value of the first value is: b INT i = 2.8 * 6; a) 12 b) 16 c) 17 D) 184, the value of the following expression is: CA) 1 <3 && 5 <7 b)! (2> 4) c) 3 & 0 && 1 D)! (5 <8) || (2 <8) 5, set int A = 10, b = 11, c = 12; expression (A B) 10 || x <20 c) x> 10 & x <20 d)! (X <= 10 || x> = 20 9. If the integer variable x = 2, the result of the expression x << 2 is: DA) 2 b) 4 c) 6 D) 810, set a = 1, b = 2, then (a ) b The values of the two expressions of A are: AA) 3, 3 b) 3, 4 c) 4, 3 d) 4, 4 2, the program is filling the blank. 1. The following program calculates the sum of the natural numbers of 1000 to be completely removed. #include void main () {int x = 1, sum; sum = 0 _______; while (true) {if (x> 1000) Break; if (x% 3 == 0) SUM = x; x Cout << Sum << Endl;} III, assuming 10 integers: 32, 64, 53, 87, 54, 32, 98, 56, 98, 83.
Is the output result of the following procedure? #include void main () {INT A, B, C, X; A = b = c = 0; for (int K = 0; K <10; K ) {cin >> x; switch ( X% 3) {case 0: a = x; break; case 1: b = x; break; case 2: c = x; break;}} cout << a << "," << b << ", "<< c << Endl;} Result: 141, 64, 452, write the following procedure operation results. #include void main () {Int J, K; for (j = 5; j> 0; j -) {for (k = j; k> 0; k -) cout << " * "; Cout << Endl;}}}: ************** 5, write the run results of the following programs. #include #include void main () {cout << "x_width =" << cout.width () << endl; cout << "x_fill =" <
#include #include using namespace std; void main () {int A, b, c; float x1, x2, z; cin >> a >> b >> C; z = b * b- 4 * a * c; if (z> 0) {x1 = ((- b) SQRT (z)) / (2 * a); x2 = ((- b) -SQRT (z)) / (2 * a); cout << "The result: x1 =" << x1 << "x2 =" << x2 << endl;} else if (z == 0) {x1 = -b / (2 * a); COUT << "The result: x1 =" << x1 << endl;} else cout << "no results";} 2, writing programs output all daffodils. The number of daffodils refers to a three-digit number, and its number of cubes is equal to this. For example: 153 = 13 53 33. #include using namespace std; void main () {Int A, b, c; for (int i = 100; i <= 999; i ) {a = I / 100; b = I% 100/10; C = I% 10; IF (A * a * a b * b * b c * c * c == i) cout << i << endl;}} 3, writing programs, calculating s = 1 ( 1 2) (1 2 3) ... (1 2 3 ... N) value. #include using namespace std; void main () {INT N, S, SUM = 0; CIN >> N; for (int i = 1; i <= n; i ) {s = 0; for (int J = 1; j <= i; j ) s = j; SUM = S;} Cout << Sum << Endl;} 4, a department store in order to promote, adopt shopping discounts. (1) More than 1,000 yuan, according to the 95% discount; (2) in more than 200,000 yuan, according to a 10% discount; (3) in more than 3,000 yuan, according to eight five% discount; (4) at 5000 yuan The above, according to 20% discount. Write a program, enter the number of shopping, calculate and output a discount price.
(Requirements to write Switch statement) #include using namespace std; void main () {int Cost; double price, d; cin >> Cost; if (COST> 5000) D = 0.8; switch (COST / 1000) {Case 0: D = 1.0; Break; Case 1: D = 0.95; Break; Case 2: D = 0.9; Break; Case 3: Case 4: D = 0.85; Break;} price = COST * D; COUT << Price << Endl;} 4, exchange a one-piece banknote to a coin, two-point and five-fifth coins, assume that each of the at least one, calculates how many exchange methods are calculated and printed out various conversion methods. #include using namespace std; void main () {Int A, b, c, count = 0; for (a = 1; a <100; a ) for (b = 1; b <100; b ) for (c = 1; c <100; C ) IF (C * 5 B * 2 a == 100) {count ; cout << "1 point:" << a << ", 2 points:" << B << ", 5 points:" << c << endl;} cout << "counts: << count << end1;} 6," same configuration "refers to such an integer: it happens to appear The right end of the square. Such as: 376 * 376 = 141376. Please find all the "same configurations" within 10,000. #include using namespace std; void main () {for (int i = 1; i <1000; i ) {IF (i <10 && i == i * i% 10) cout << i << endl; else IF (i <100 && i == i * i) cout << i << endl; else if (i <1000 && i == i * i% 1000) cout << i << endl; else if (i == i * I% 10000) cout << i << endl;}} I am-choice criteria: SELECT TOP 100 PPMM from Girl Where agnween Hobby Order by Beautiful DESC
Welcome to the programming enthusiast website http://www.programfan.com/ The following is a follower
#include using namespace std; void main () {INT N, S = 0, SUM = 0; CIN >> n; for (int i = 1; i <= n; i ) {s = s i SUM = S;} cout << sum << endl;}
#include void main () {Int i, n, s, sum, counter; sum = 0; s = 0; counter = 1; Printf ("/ ninput a number! / n"); scanf "% D", & n); for (i = 1; i <= n; i ) {s = counter; Sum = S; counter ;} PRITNF ("Result IS:% D / N", SUM;} The program is that I have implemented in the C language, a loop than the answer, and it is possible to have some efficiency!
// 3 ^, <<, >>, & etc, etc., I really admire home! #include using namespace std; void main () {int N; cin >> n; cout << "Result: << (n * (n 1) * (n 2)) / 6 << Endl;} // I think this should have the highest efficiency
I just learned C , I don't give you guides! #include long fun (int A) {s = a; SUM = S; if (a = 1) RETURM SUM; ELSE RETURM FUN (A-1); // This is not right? } void main () {Long Fun (INT A) INT X, SUM; S = 0; SUM = 0; long y; cout << "Please enter an integer:"; cin >> x; y = fun ( x); cout << "sum =" << y; returm;}
The younger brother just learned the C language, did the question of a few VE big brother, did not do well, but I think is the heavy weight to participate, just stick it. Mo laugh: #include main () {INT N, S = 0, J = 1, I; Printf ("please input num: / n"); scanf ("% d", & n); for (i = n; i> = 0; I -) {s = j * i; j ;} printf ("% d", s);} Lo a few VE methods can be said more than I 6 ! Oh, or ask him to publish his answer // The following is a low efficiency, recurrent achievement. #include using namespace std; long calc (int N) {return (n == 1)? 1: Cal (n-1) n * (n 1) / 2;} void main () {INT I; cin >> i; cout << "Result: << Cal (i) << endl;}