#include <iostream>
using namespace std;
struct student
{
char name [50];
char S_code [5];
int fees;
};
void display(struct student);
double input(struct student&);
int main()
{
double total;
student stu;
total=input(stu);
display(stu);
input(stu);
return 0;
}
double input (struct student&stu )
{
double total=0;
char again ='y';
cin.getline (stu.name,50);
while (again =='y');
{
cin>>stu.S_code>>stu.fees;
total=total+stu.fees;
cin>>again;
}
return total;
}
void display(struct student stu,double totalfees)
{
cout<<"total fee for"<<stu.name<<"is"<<totalfees<<endl;
}
alanso
0
Newbie Poster
Recommended Answers
Jump to Postcorrect the parameters of the display function to match the one in main and it's function prototype
Jump to Postshe means that the parameters on line 15 and line 58 do not match. They have to be the same. Also, its best to always pass structures around by reference, never by value, because the program has to duplicate everything in the structure when it is passed by value. You …
All 7 Replies
zeroliken
79
Nearly a Posting Virtuoso
alanso
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
misokolsky
-1
Newbie Poster
alanso
0
Newbie Poster
misokolsky
-1
Newbie Poster
Saith
commented:
giving too much code away
-1
alanso
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.