0 of 4 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 4 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
23题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include <iostream> using namespace std; int main() { int max, min, sum, count = 0; int tmp; cin >> tmp; if (tmp==0) return 0; max = min = sum = tmp; count++; while (tmp != 0) { cin >> tmp; if (tmp != 0) { sum += tmp; count++; if (tmp > max) max = tmp; if (tmp < min) min = tmp; } } cout << max << "," << min << "," << sum / count << endl; return 0; } |
输入:1 2 3 4 5 6 0 7
输出:
24题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <iostream> using namespace std; int main() { int i=100,x=0,y=0; while (i>0) { i--; x=i%8; if (x==1) y++; } cout<<y<<endl; return 0; } |
输出为:
25题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include <iostream> using namespace std; int main() { int a[6] = {1, 2, 3, 4, 5, 6}; int pi = 0; int pj = 5; int t, i; while (pi < pj) { t = a[pi]; a[pi] = a[pj]; a[pj] = t; pi++; pj--; } for (i = 0; i < 6; i++) cout << a[i] << ","; cout << endl; return 0; } |
输出为:
26题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <iostream> using namespace std; int main() { int i,length1, length2; string s1, s2; s1 = "I have a dream."; s2 = "I Have A Dream."; length1 = s1.size(); length2 = s2.size(); for (i = 0; i < length1; i++) if (s1[i] >= 'a' && s1[i] <= 'z') s1[i] -= 'a'-'A'; for (i = 0; i < length2; i++) if (s2[i] >= 'a' && s2[i] <= 'z') s2[i] -= 'a'-'A'; if (s1 == s2) cout << "=" << endl; else if (s1 > s2) cout << ">" << endl; else cout << "<" << endl; return 0; } |
输出为: