标签:amp [] logs while 答案 c++ tor prim sys
练习3.41
1 int main() 2 { 3 int a[] = { 0,1,2,3,4,5 }; 4 vector<int> a1(begin(a) + 1, begin(a) + 5); 5 for (auto c : a1) 6 cout << c << endl; 7 system("pause"); 8 return 0; 9 }
练习3.42
1 int main() 2 { 3 int num; 4 vector<int> a1; 5 while (cin >> num) 6 a1.push_back(num); 7 int a[10]; 8 int *beg = begin(a); 9 int *last = end(a); 10 auto beg1 = a1.cbegin(); 11 auto last1 = a1.cend(); 12 if (a1.size() >= 10) 13 { 14 while (beg != last) 15 { 16 *beg = *beg1; 17 beg++; 18 beg1++; 19 } 20 } 21 else 22 { 23 while (beg1 != last1) 24 { 25 *beg = *beg1; 26 beg++; 27 beg1++; 28 while (beg1 == last1 && beg != last) 29 { 30 *beg = 0; 31 beg++; 32 } 33 } 34 } 35 for (auto c : a) 36 cout << c << endl; 37 system("pause"); 38 return 0; 39 }
标签:amp [] logs while 答案 c++ tor prim sys
原文地址:http://www.cnblogs.com/wuyinfenghappy/p/7246447.html