c++

Calculate total fee of n number of student after including total fine and display on screen.

#include #include class student { private: char name[15]; int rn; float fee,fine,tf; } public: void getdata(); void calc(); void printdata(); }; void student::printdata() { cout<< name<<"tt"<<rn<<"t"<<fee<<"t"<<fine<<"t"<<tf; } void student::getdata() { cout<>name; cout<>rn; cout<>fee; cout<>fine; } void student::calc(); { tf=(fee+fine); } main() { student a[60]; int i,n; clrscr(); cout<>n; cout<<"n Details of student:"; for(i=1;i<=n;i++) { cout<<"n […]

Calculate simple interest by using concept of class and object

#include #include class sint { private: float p,r,t,si; public: void dentry(); void calc() { si=(p*r*t)/100; } void display(); }; void sint::display() { cout<<"n Principlettratettimettinterest:"; cout<<"n "<<p<<"ttt"<<r<<"t"<<t<<"tt"<<si; } void sint::dentry() { clrscr(); cout<>p; cout<>r; cout<>t }; main() { class sint x; x.dentry(); x.calc(); x.display(); getch() };

Program to enter details of ‘n’ number of book and display back all records on screen by using concept of array of structure with access by pointer

#include #include struct book { char name[20]; int nop; char author[20]; float price; }a[10]; main() { int n,i; struct book *p[70]; clrscr(); cout<>n; for(i=1;i<=n;i++) { p[i]=&a[i]; cout<<"nBook number: "<<i; cout<>p[i]->name; cout<>p[i]->nop; cout<>(*p[i]).author; cout<>p[i]->price; cout<<"nThe entered records are: n"; } clrscr(); cout<<"nS.notNamettN_OF_PAGEtAUTHOR_NAMEtPrice"; for(i=1;i<=n;i++) { cout<<"n"<<i<<"t"<<(*p[i]).name<<"tt"<<(*p[i]).nop<<"tt"<<(*p[i]).author<<"tt"<price; } getch(); }