Recent

recentposts

Practice_02

Practice_02 

Project for a bank employee who wants to take the following data of the account holder using structure. ( Name, Age, Gender, Date of Birth, Account number, Total Amount ) .

Also ask the customer to add or withdraw the money.

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

 

struct employee {

char name[50] ;

int age ;

char gender ;

char dob[20] ;

long acc_number ;

double balance ;

} ;

employee data ;

 


void data_entry() {

cout<<"\n Enter the Name of Account Holder : " ;

gets(data.name) ;

cout<<"\n Enter the Age  :" ;

cin>>data.age ;

cout<<"\n Enter the Gender , male, female, other , use (M/F/O) : " ;

cin>>data.gender ;

cout<<"\n Enter the Account number :" ;

cin>>data.acc_number ;

cout<<"\n Enter the Total balance :" ;

cin>>data.balance ;

}



void add_amount() {

double amount ;

cout<<"\n Enter the amount to be added : " ;

cin>>amount ;

data.balance = data.balance + amount ;

cout<<"\n\n\t\t Amount added " ;

}

 

void withdraw_amount() {

double amount ;

cout<<"\n Enter the amount to be withdraw : " ;

cin>>amount ;

data.balance = data.balance - amount ;

cout<<"\n\n\t\t Amount withdraw " ;

}

 

void display() {

clrscr() ;

cout<<"\n Details of Account Holder " ;

cout<<"\n Name  : "<<data.name ;

cout<<"\n Age :  "<<data.age ;

cout<<"\n Gender : "<<data.gender ;

cout<<"\n DOB : "<<data.dob ;

cout<<"\n Account Number : "<<data.acc_number ;

cout<<"\n Balance : "<<data.balance ;

}

 


void main () {

clrscr() ;


int i ;


data_entry() ;


while(1) {

cout<<"\n Use the following Keys - " ;

cout<<"\n 1 – Add amount  \n 2 – Withdraw amount  \n 3 – Display details \n 4 - Exit " ;


cout<<"\n Enter your choice : - ";

cin>>i ;


switch(i) {

case 1 : add_amount() ;

                break ;


case 2 : withdraw_amount() ;

                break ; 


case 3 : display() ;

                break ;


case 4 : exit(0);

                break ;


default : cout<<"\n The input is invalid !! " ;

                break ;

   }

}


getch() ;

}

 

 

Project for a school counter who wants to take the following data of the student fee details using structure,  ( Name, Acc.No, Roll.No, Fee Paid, Fee due, Fine, ) .

 

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

 

struct school {

 char name[15] ;

 long acc ;

 int roll ;

 double fee ;

 double paid ;

 double due ;

 double fine ;

} ;

school info ;


void input_info() {

cout<<"\n Enter the Name of the Student  : " ;

gets(info.name) ;

cout<<"\n Enter the Roll. No . :   " ;

cin>>info.roll ;

cout<<"\n Enter the Total fee paid : " ;

cin>>info.fee ;

cout<<"\n Enter the paid amount :" ;

cin>>info.paid ;

cout<<"\n Enter the fine :" ;

cin>>info.fine ;

}

 


void fee_payment() {

double amount ;


cout<<"\n Total fine till now is  : "<<info.fine ;

cout<<"\n Enter the amount to be added : " ;

cin>>amount ;


float net_amount = amount info.fine  ;

info.paid = info.paid + net_amount;

info.fine = 0 ;


cout<<"\n\n\t\t Amount added  = "<<net_amount ;

}



void display() {

clrscr() ;

cout<<"\n Details of Student " ;

cout<<"\n Name  : "<<info.name ;

cout<<"\n Roll No :  "<<info.roll ;

cout<<"\n Total fee : "<<info.fee ;

cout<<"\n Paid amount : "<<info.paid ;

cout<<"\n Due amount : "<<info.fee info.paid ;

cout<<"\n Fine : "<<info.fine ;

}

 


void main () {

clrscr() ;


int i ;

input_info() ;


while(1) {

cout<<"\n Use the following Keys - " ;

cout<<"\n 1 – Add amount  \n 2 – Display details \n 3 - Exit" ;

cout<<"\n Enter your choice : - " ;

cin>>i ;


switch) {

case 1 : fee_payment() ;

                break ;


case 2 : display() ;

                break ;


case 3 : exit(0) ;

                break ;


default : cout<<"\n The input is invalid !! " ;

                break ;

  }

}

getch() ;

}




SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Please give your valuable suggestions