5 01 89 02 78 03 56 04 92 05 76
01 89 02 78 03 56 04 92 05 76
c++对象数组这种东西,怎么说呢,灵活运用吧,反正代码是一看就能明白的!
#include<iostream>
#include<string>
using namespace std;
class student
{
private:
    string i;
    int g;
	
public:
	void in()
	{
		cin >> i >> g;
	}
	
	void out()
	{
		cout << i << " " << g << endl;
	}
};
int main()
{
	int n,i;
	student stu[500];
	cin>>n;
	for(i=0;i<n;i++)
		stu[i].in();
	for(i=0;i<n;i++)
		stu[i].out();
	return 0;
}
原文地址:http://blog.csdn.net/u013634961/article/details/39692403