ARRAY PARAMETER

It must allow the user to input the values for the Midterm Rating and Final Rating based on Figure 2.
This must be achieved by a function call to inputRating(stud, n).
Valid values for Midterm Rating and Final Rating ranges from 70 to 100.
All inputs must be validated.


fig. 2 looks like this
-for each class, Enter the Midterm grade, Final grade (seperated by a space)
CSC111: 80 85
CSC112: 89 89

this is my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
using namespace std;
//structure type declaration
struct studRec{
    int IDnum;
    int code;
    int mRating;
    int fRating;
    float fGrade;
};



void getTable(struct studRec s[], int n){
    //inputting user values into fields
    for(int j=0; j<n; j++){
        string fn="", ln="";
        cout<<endl<<"Record"<<(j+1)<<"---"<<endl;
        cout<<"ID number: "; cin>>s[j].IDnum;
        cout<<"cCode: "; cin>>s[j].code;     
    }    
         

}

int inputRating (struct studRec  s[], int n ){
    for(int j=0; j<n; j++){
	cout<< s[j].code << "      " << " | " << "     " << endl;
	
}
}

void displayTable(struct studRec s[], int n){
//displaying an array of struct
    cout<<endl;
    	
    	cout<<"ID num"<<"\t\t";
    	cout<<"Code"<<endl;
    for(int j=0; j<n; j++){
        cout<<s[j].IDnum<<"\t\t";
        cout<<s[j].code<<endl;
        
       
    }
 


}

int main(){

    //declaring/initializing an array of struct
    int n=2;    
    struct studRec s[n];
    
    //inputting user values into fields
    getTable(s, n);
                            
    //displaying an array of struct
    displayTable(s, n);
}   
Last edited on
sorryy, thankyouuu
> This must be achieved by a function call to inputRating(stud, n).
Right, so what's your question?

You have a function, but you never call it.
You managed to write code to call getTable and call displayTable, so what's stopping you calling inputRating?

Sure, inputRating lacks input of data, but you already know how to input things in getTable.
So again, you have all you need.
Topic archived. No new replies allowed.