Apart from what PrafullaVedante said, you are also needlessly creating a struct on the heap, and then forgot to delete it. Just create it on the stack like this:
myvec = new vector<mystruct>;
for(;iLoop<itemp;iloop++)>
{
myStruct mystr;
cout<<"Enter the data for m1 \n";
cin>>iMark;
mystr.iTemp1 = iMark;
iMark = 0;
cout<<"Enter the data for m1 \n";
cin>>iMark;
mystr.iTemp2 = iMark;
myvec->push_back(mystr);
}
Note that
std::vector::push_back()
will create a copy of the passed value anyway, so there is no need to create new instances of
myStruct
yourself.