delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/16/13:53:17

From: "John" <fubu36 AT stny DOT rr DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: vectors
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <jrnK4.4389$4W3.69583@typhoon.nyroc.rr.com>
Date: Sun, 16 Apr 2000 18:15:43 GMT
NNTP-Posting-Host: 24.95.139.17
X-Complaints-To: abuse AT stny DOT rr DOT com
X-Trace: typhoon.nyroc.rr.com 955908943 24.95.139.17 (Sun, 16 Apr 2000 14:15:43 EDT)
NNTP-Posting-Date: Sun, 16 Apr 2000 14:15:43 EDT
Organization: Time Warner Road Runner - Binghamton NY
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I need a little help doing something
What I want to do is this

class student
{
     // i know all this shouldn't be public but for this
     // example it is
     char studentName[20];
     vector<int> grade;
}

int main()
{     
     vector<student> mathClass(10);
     cout<<"size of student "<<student.size()<<"size of
          grade "<<student.grade.size()<<endl;
     return 0;
}
this code gives me an error of " 'class vector <student,allocator student> >' has no member named 'grade'
whats wrong with this and how would i set the vector grade in class student to start with something like 15 elements? I know this is something that would need to be done in the classes constructer but how?

Thanks!



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019