Answer to Question #200912 in C++ for SUNNY

Question #200912

Create a structure student with roll,name,10th marks, +2marks and graduation marks,and find the total marks of each of the above courses individually by using function overloading.


1
Expert's answer
2021-05-31T00:54:09-0400
#include <iostream>


using namespace std;
//roll,name,10th marks, +2marks and graduation marks
struct Student  
{  
    string roll;
    string name;   
    int marks_10th;  
    int marks_2pls;
    int graduation_marks;  
};
void totalMarks(Student m1){
    int n;
    cout<<"Enter number of subjects: ";
    cin>>n;
    for (int i=0;i<n;i++){
        cout<<"Enter marks for subject "<<i+1<<":";
        cin>>m1.marks_10th;
    }
}
void totalMarks(Student m2,int n){
    cout<<"Enter number of subjects: ";
    cin>>n;
    for (int i=0;i<n;i++){
        cout<<"Enter marks for subject "<<i+1<<":";
        cin>>m2.marks_2pls;
    }
}
void totalMarks(){
    Student m3;
    int n;
    cout<<"Enter number of subjects: ";
    cin>>n;
    for (int i=0;i<n;i++){
        cout<<"Enter marks for subject "<<i+1<<":";
        cin>>m3.graduation_marks;
    }
}
int main()
{
   
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog