2524: 输出学生信息
Description
将输入的学生信息按照要求重新输出。
Input
第一行是整数t,表明数据组数
在每组数据中,
第一行先是整数n(n<100),表示有n个学生。
接下来有n行,每行表示一个学生。先是一个无空格的字符串,表示姓名,然后是一个非负整数,表示学号。
姓名长度不超过100字符,学号小于1000。
Output
按照输入的顺序,输出每个学生的信息。先输出学号,再输出姓名,中间用单个空格隔开。
一组数据处理完后,要输出一行 “****”。
Sample Input
2
3
Tom 12
Jack 20
Marry 89
2
Jade 78
White 76
Sample Output
12 Tom
20 Jack
89 Marry
****
78 Jade
76 White
****
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#include<iostream> using namespace std; class Student { public: int a; char b[100]; Student() {} Student(char b1[],int a1) {a=a1;} void Read() { cin>>b>>a; } void Print() { cout<<a<<' '<<b<<endl; } }; int main() { int t; cin >> t; Student s("Tom",12); while( t-- ) { int n; cin >> n; Student st; for( int i = 0;i < n; ++i) { st.Read(); st.Print(); } cout << "****" << endl; } return 0; } |