#include <iostream>
#include <string>
using namespace std;
struct student {
string name;
int age;
double height;
};
int main() {
student s;
cin >> s.name >> s.age >> s.height;
cout << s.name << " " << s.age << " " << s.height << endl;
return 0;
}
太low的写法:
#include <iostream>
#include <string>
using namespace std;
struct student {
string name;
int age;
double height;
};
int main() {
string name;
int age;
double height;
getline(cin, name);
cin >> age;
cin >> height;
student s;
s.name = name;
s.age = age;
s.height = height;
cout << s.name << " " << s.age << " " << s.height << endl;
return 0;
}
|