Article View: alt.comp.lang.learn.c-c++
Article #97Re: Problematic Program
From: Josh Sebastian
Date: Sun, 20 Oct 2002 21:07
Date: Sun, 20 Oct 2002 21:07
51 lines
2669 bytes
2669 bytes
On Sun, 20 Oct 2002 16:55:02 -0400, "CM" <mckenzie992@comcast.net>
wrote:
>Hello everyone,
>I thought I had finished a c++ V2 program when I ended up having several
>unexpected compilation errors that I am not sure how to fix. The jist of
>the program is to take 5 student names, 5 ids for those students, 3 grades
>for each student and then calculate gpa displaying in a table format:
>Name Name 1 Name 2
>Id 999 222
>Grade 1 90 80
>Grade 2 90 80
>Grade 3
>GPA
>etc.
>
>I have included what I have so far, was hoping someone could help to find my
>mistake.
>#include <string>
>#include <iostream>
>using namespace std;
>#include <stdlib.h>
>void main()
int main()
>{
>int noOfGrades=3;
>int noOfStudents=5;
>char names[noOfStudents]; // array of names (strings)
The above definition is illegal. Only a constant integral expression
can go inside the square brackets. Same goes for the following two
array definitions.
>char ID[noOfStudents]; // array of ID's (strings)
>double Grades[noOfStudents][noOfGrades]; // array of 5 arrays each of 3
>elements (each student has 3 double grades)
>double GPA[5]; // array of gpa's (doubles)
>double points;
>
>for (i=0;i=noOfStudents-1;i++)
I don't think that does what you want. ITYM
for(int i=0; i<noOfStudents; ++i)
You make similar errors later.
I don't know if that's everything... just skimmed the rest.
Josh
Technical Details
Message-ID:
<7h66rucomaus4hkbbg0d5iib7qs1uu54he@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!chi1.webusenet.com!rip!news.webusenet.com!cox.net!p01!news2.east.cox.net.POSTED!53ab2750!not-for-mailReferences:
<ESudnc40b4i4hS6gXTWcow@comcast.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4ba,635d58b7486c58ea X-Google-Attributes: gid10d4ba,public X-Google-Thread: 109fba,635d58b7486c58ea X-Google-Attributes: gid109fba,public X-Google-Thread: 114592,635d58b7486c58ea X-Google-Attributes: gid114592,public X-Google-ArrivalTime: 2002-10-20 14:26:24 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!chi1.webusenet.com!rip!news.webusenet.com!cox.net!p01!news2.east.cox.net.POSTED!53ab2750!not-for-mail From: Josh Sebastian <curien@cox.net> Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++ Subject: Re: Problematic Program Message-ID: <7h66rucomaus4hkbbg0d5iib7qs1uu54he@4ax.com> References: <ESudnc40b4i4hS6gXTWcow@comcast.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 51 Date: Sun, 20 Oct 2002 21:07:25 GMT NNTP-Posting-Host: 68.10.124.242 X-Complaints-To: abuse@cox.net X-Trace: news2.east.cox.net 1035148045 68.10.124.242 (Sun, 20 Oct 2002 17:07:25 EDT) NNTP-Posting-Date: Sun, 20 Oct 2002 17:07:25 EDT Organization: Cox Communications