How can I initialize an array whose type is a struct?
learning c++
learning_c@hotmail.com
Wed Sep 1 16:37:00 GMT 2004
I have a short code to print the month and days in a month. I declared a
struct including month and days. but it does not work.
Please help me.
#include<iostream>
#include<vector>
using namespace std;
struct year{
char* month;
int day;
};
int main(){
vector<year>arr(("Jan",31),("Feb",28));
vector<year>::iterator iter;
for(iter=arr.begin(); iter!=arr.end(); iter++)
cout<<iter->month<<" "<<iter->days<<endl;
return 0;
}
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
More information about the Gcc-help
mailing list