public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "learning c++" <learning_c@hotmail.com>
To: gcc-help@gcc.gnu.org
Subject: How can I initialize an array whose type is a struct?
Date: Wed, 01 Sep 2004 16:37:00 -0000	[thread overview]
Message-ID: <BAY12-F238Ut65BVEpV00046363@hotmail.com> (raw)

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

             reply	other threads:[~2004-09-01 16:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-01 16:37 learning c++ [this message]
2004-09-01 17:50 ` Eljay Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY12-F238Ut65BVEpV00046363@hotmail.com \
    --to=learning_c@hotmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).