It has become apparent to me that I do not understand the rleation ship of a class array and a vector.
Assume I have the following and I want to change it to vector format
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
class School
{
public:
School ();
School (string,double);
string name;
float tuition;
};
School::School()
{
name="";
tuition=0.;
}
School::School(string n,double t)
{
name=n;
tuition= t;
}
int main ()
{
School mySchool [5] = {School ("John", 10.),
School ("Jim", 11.),
School ("Greg", 12.),
School ("Spencer", 13.),
School ("Joan", 14.)};
int i=0;
while (i < 5)
{
cout << mySchool[i].name << " " << mySchool[i].tuition << endl;
++i;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Give me some options. Assume I am a coplete idiot.