jeudi 29 avril 2021

how can I print a message in if statement? [closed]

#include <iostream>
#include<string>
using namespace std;
int main() {
    string username, password, option, admin, client,type;
    cout << "enter the username" << endl;
    cin >> username;
    cout << "enter the password" << endl;
    cin >> password;
    cout << "are you admin or client?" << endl;
    cin >> option;
    if (option == admin) {
        cout << "Add a New Account." << endl;
        cout << "Modify An Account." << endl;
        cout << "Close An Account." << endl;
        cout << "List All Accounts." << endl;
    }
    else if (option == client) {
        cout << "Balance Enquiry" << endl;
        cout << "Withdraw Amount." << endl;
        cout << "Deposit Amount." << endl;
        cout << "Transfer from his account to another account." << endl;
    }
    cout << "Register as admin/client?" << endl;
    cin >> type;
    cout << "log out" << endl;

    return 0;
}

These 2 messages Are you admin or client? && Register as admin/client? appear behind each other without enter in the if statment

Aucun commentaire:

Enregistrer un commentaire