my C++ might include multi-error... the first one is how to add struct element in a vector
my code will be like this:
#include<iostream>
#include<vector>
using namespace std;
struct eMailMsg {
string to; // i.e. "professor@stanford.edu"
string from; // i.e. "student@stanford.edu"
string message; // body of message
string subject; // i.e. "CS106 Rocks!"
int date; // date email was sent
int time; // time email was sent
};
int main(){
vector <eMailMsg> mailVector;
mailVector[0]={"professor@stanford.edu","student@stanford.edu","body of message",4,16};
for( std::vector<eMailMsg>::const_iterator i = mailVector.begin(); i != mailVector.end(); ++i)
std::cout << *i << ' ';
system("pause");
return 0;
}