C++ 6.0 Struct Question

Discussion in 'OT Technology' started by Scoob_13, Feb 9, 2003.

  1. Scoob_13

    Scoob_13 Anything is possible, but the odds are astronomica

    Joined:
    Oct 5, 2001
    Messages:
    73,781
    Likes Received:
    38
    Location:
    Fort Worth. Hooray cowgirls.
    Code:
    struct Student
    {
    	char Name[30];
    	int IDNum;
    	int *Tests;
    	int Average;
    	int Grade;
    };
    
    Class is defined as an array of Students

    Code:
    void CreateGrds(Student *Class, int amount)
    {
    	int tempgrd;
    	
    	cout << "How many grades?" << endl;
    	cin >> tempgrd;
    	
    	for(int i=0;i<amount;i++)
    (67)		Class[i].Tests = new Class[i].Tests[tempgrd];
    
    	return;
    (70)}
    
    That's my function for creating a new array of Tests (int array), however for some reason I get the following errors:

    Code:
    (67) : error C2061: syntax error : identifier 'Tests'
    (70) : error C2143: syntax error : missing ';' before '}'
    
    Lines are marked in parathesis.

    I get the error C2143 over 100+ times :confused:

    Very weird. Any help?
     
  2. Nocera

    Nocera ...

    Joined:
    Aug 9, 2000
    Messages:
    1,307
    Likes Received:
    0
    Location:
    Long Island, NY
    Code:
    Class[i].Tests = new int[tempgrd];
    
     
  3. Scoob_13

    Scoob_13 Anything is possible, but the odds are astronomica

    Joined:
    Oct 5, 2001
    Messages:
    73,781
    Likes Received:
    38
    Location:
    Fort Worth. Hooray cowgirls.
    I hate me :mad:


    Thank you sir :bigthumb:
     

Share This Page