Apr 1, 2012 at 11:02am UTC
How to insert the function on this program>
#include<iostream>
using namespace std;
struct Student_Record{
int id_num;
int assignment;
int quiz;
int test;
char grade;
};
void get_data(Student_Record &p);
int calc_mark(Student_Record p);
Student_Record read_data();
void print_all(const struct Student_Record p{});
int main()
{
Student_Record amir,naim, amirNaim[2];
int amirtotal_mark, naimtotal_mark;
get_data (amir);
amirtotal_mark=calc_mark(amir);
if (amirtotal_mark>=60)
amir.grade ='p';
else
amir.grade='F';
naim= read_data();
amirNaim[0]=amir;
amirNaim[1]=naim;
naimtotal_mark=calc_mark(amirNaim[1]);
if (naimtotal_mark>=60)
amirNaim[1].grade='P';
else
amirNaim[1].grade='F';
print_all(amirNaim);
system("pause");
return 0;
}
Apr 1, 2012 at 11:22am UTC
What do you meant by "insert the function"?
Apr 1, 2012 at 11:29am UTC
this question is complete the program.The program ask the user to enter mark for assignment,quiz and test for amir and naim,the calculates the total mark using simple formula (assignment+quiz+test)/3.Finally the program print report card for both students and the report display all content of the structure.You required to write definitions for the given 4 function performing task in the program.
Apr 1, 2012 at 11:31am UTC
So you want us to do your homework for you?
Apr 1, 2012 at 11:32am UTC
want to ask how to solve this i try but nothing happen...
Apr 1, 2012 at 11:34am UTC
want to ask who expert ....about this program
Apr 1, 2012 at 11:35am UTC
Start by considering what you need each method to do. The assignment has given you descriptions for each; how would you translate that into code?
Apr 1, 2012 at 11:36am UTC
i not expert about c++ can you guide me...
Apr 1, 2012 at 11:39am UTC
Not if you don't even look like you've made an attempt.
Apr 1, 2012 at 11:41am UTC
i know
int calc_mark(Student_Record p);
{
int assignment;
int quiz;
int test;
amirtotal_mark=(assignment+quiz+test)/3;
return amirtotal_mark;
}
Last edited on Apr 1, 2012 at 11:44am UTC
Apr 1, 2012 at 11:44am UTC
void get_data(Student_Record &p);
{
int id_num;
int assignment;
int quiz;
int test;
cout<<"ID num: ";
cin>>id_num;
cout<<"Assingment: "
cin>>id_num
cout<<"Quiz: "
cin>>quiz;
cout<<"Test";
cin>>test;
}
Apr 1, 2012 at 11:45am UTC
this what i done
void get_data(Student_Record &p);
{
int id_num,assignment,quiz,test;
cout<<"Put id num : ";
cin>>id_num;
cout<<"Assignment mark:";
cin>>assingment;
cout<<"Quiz mark: "
cin>>quiz;
cout<<"Test Mark: "
cin>>mark;
}
int calc_mark(Student_Record p)
{
int assignment,quiz,test;
amirtotal_mark=(assignment+quiz+test)/3
return amirtotal_mark;
}
Student_Record read_data()
{
cout<<id_num;
cout<<assignment;
cout<<quiz;
cout<<test;
}
void print_all(const struct Student_Record p{})
{
cout<<Student_Record.id_num;
cout<<Student_Record.assigment;
cout<<Student_Record.quiz;
cout<<Student_Record.test;
cout<<Student_Record.grade;
}