blob: 28186d390342ba2e859778c2afd86d69f92545da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include <iostream>
#include <string>
struct name {
std::string name;
int num[5];
};
int main(void) {
int x;
int i = 0;
struct name foo;
struct name bar;
std::cin >> foo.name;
while (std::cin >> x) {
foo.num[i] = x;
i++;
if (i >= 5)
break;
}
i = 0;
if (std::cin)
std::cout << "We have data" << std::endl;
std::cin.clear();
std::cin >> bar.name;
while (std::cin >> x) {
bar.num[i] = x;
i++;
if (i >= 5)
break;
}
std::cout << foo.name.size() << " " << bar.name.size() << std::endl;
return 0;
}
|