🔒 Closed C++ program mga master ano po kaya ang problema sa code ko. patulong po please

Status
Not open for further replies.
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>

using namespace std;


int mainMenu();
int userMenu();
void userBalance();
void userWithdraw();
void userDeposit();


double balance =0.0;

int main(){



string inputName="";
int inputPin=0;
string name= "";
int pin=0 ;
char input='y';
cout <<"Do you have existing account?";
cin>>input;
if (input !='y'){
cout << "Welcome Please Create your account Here."<<endl;
cout << "Create Name: ";
cin >> inputName;
cout << "Create 6 digit pin: ";
cin >> inputPin;
}
cout <<" WELCOME" <<endl;
cout <<"Login Your Account" << endl;
cout << "\n Enter Name: ";
cin >> name;
cout << "\n Enter PIN: ";
cin >> pin;


while (name != inputName || pin != inputPin)
{


cout << endl<< endl;

cout <<"You Entered An Invalid Account" << endl;
cout << "Enter Name: ";
cin >> name;
cout << "Enter Pin: ";
cin >> pin;
cout << "\n";
}
userMenu();


return 0;

}






int userMenu(){
switch(mainMenu()){
case 1:
userBalance();
userMenu();
break;
case 2:
userWithdraw();
userMenu();
break;
case 3:
userDeposit();
userMenu();
break;
case 4:
cout <<"Exitting...";
userMenu();
break;
default:
cout <<"Invalid Input."<< endl;
cout <<"Please Select 1-4. "<< endl;
break;
}
return 0;
}




int mainMenu(){
int input =0;
cout <<"\tMENU"<<endl<<endl;
cout <<"Select Your Transaction"<< endl<< endl;
cout <<"1. BALANCE "<<endl;
cout <<"2. WIDTHRAW "<< endl;
cout <<"3. DEPOSITE "<< endl;
cout <<"4. EXIT "<< endl;
cout <<endl<<endl;
cout <<"Enter your Transaction: ";
cin >> input;
return input;


}


void userBalance(){

cout <<"Account Balance :"<< balance<< endl;
}



void userWidthraw(){
double widthraw =0.0;

cout <<"Enter Amount to Widthraw: ";
cin >> widthraw;
cout<< endl<<endl;
if (balance >widthraw){
cout <<"You Have not Enough Balance.";
cout <<"Please Enter Enough Balance to Widthraw: ";
cin >>widthraw;

}
if (balance <widthraw){
balance =balance -widthraw;
cout <<"You Widthraw "<< widthraw <<"In Your Account."<< endl;
cout <<"Your Balance Is Now " << balance << endl;
}
}

void userDeposit(){
double deposite =0.0;
cout <<"Enter Amount To Deposite "<< endl;
cin >>deposite;
balance = balance +deposite;
cout <<"You Have Succesfully Deposite "<< deposite<< "From Your Account."<< endl;
cout <<"Your Balance Is now "<< balance << endl;

}
 
mukhang madali lang naman intindihin ung program mo kaso wala akong alam sa c++ hahhahaha kung java sana serr
 
iba yung function name ts sa naideclare mo
imbis na userWithdraw() ang nailagay nyo po ay userWidthraw();
C++:
void userWithdraw();
void userWidthraw(){
    double widthraw =0.0;
    cout <<"Enter Amount to Widthraw: ";
    cin >> widthraw;
    cout<< endl<<endl;
    if (balance >widthraw){
        cout <<"You Have not Enough Balance.";
        cout <<"Please Enter Enough Balance to Widthraw: ";
        cin >>widthraw;
    }
    if (balance <widthraw){
        balance =balance -widthraw;
        cout <<"You Widthraw "<< widthraw <<"In Your Account."<< endl;
        cout <<"Your Balance Is Now " << balance << endl;
    }
}
 
iba yung function name ts sa naideclare mo
imbis na userWithdraw() ang nailagay nyo po ay userWidthraw();
C++:
void userWithdraw();
void userWidthraw(){
    double widthraw =0.0;
    cout <<"Enter Amount to Widthraw: ";
    cin >> widthraw;
    cout<< endl<<endl;
    if (balance >widthraw){
        cout <<"You Have not Enough Balance.";
        cout <<"Please Enter Enough Balance to Widthraw: ";
        cin >>widthraw;
    }
    if (balance <widthraw){
        balance =balance -widthraw;
        cout <<"You Widthraw "<< widthraw <<"In Your Account."<< endl;
        cout <<"Your Balance Is Now " << balance << endl;
    }
}
Thanks pos Sir
 
Status
Not open for further replies.

About this Thread

  • 4
    Replies
  • 523
    Views
  • 4
    Participants
Last reply from:
Notice404

Online now

Members online
753
Guests online
660
Total visitors
1,413

Forum statistics

Threads
2,275,125
Posts
28,960,808
Members
1,232,631
Latest member
marlaa1991
Back
Top