banking program, function not calling
Mar 7, 2019 at 2:55am UTC
hey, so i have to create this banking program for my cs1 class and for some reason after my createAccount function is used and i go to my logIn function it doesn't recognize my username and password. i'm not sure why. functions are new to me, so if i'm doing something incorrect please help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <stdbool.h>
using namespace std;
//function prototypes
void go_TopMenu();
void go_CreateAccount(string &username, string &password);
void get_LogIn(string &username, string &password);
//void go_BankMenu();
//float get_Withdraw();
////float get_Deposit();
//void get_Balance();
//void go_Quit();
int main()
{
go_TopMenu();
system("pause" );
return 0;
}
void go_TopMenu()
{
int sel1; //go_Create
sel1 = 0;
cout << "Welcome to bank of banking" << endl;
cout << "1 to create account" << endl;
cout << "2 to Log in" << endl;
cout << "any other key to exit program" << endl;
cin >> sel1;
string create, login, quit,username,password;
if (sel1 == 1) go_CreateAccount(username,password);
else if (sel1 == 2) get_LogIn(username, password);
}
void go_CreateAccount(string &username, string &password)
{
cout << "Please enter a user name for your account" << endl;
cin >> username;
cout << "your account username is: " << username << endl;
cout << "Please enter a password for your account" << endl;
cin >> password;
go_TopMenu();
}
void get_LogIn(string &username, string &password)
{
string input1;
string input2;
cout << "Please Enter User Name" << endl;
cin >> input1;
cout << "Please Enter Password" << endl;
cin >> input2;
if (username == input1 & password == input2)
cout << "correct" << endl;
}
Topic archived. No new replies allowed.