#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
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.