0
#include <iostream>

using namespace std;

int main()
{
    const int password=123;
    const string username = "abc";
    int pass;
    string user;
    cout<< "Enter your username"<<endl;
    cin>>user;
    cout<< "Enter your Password"<<endl;
    cin>>pass;

    if (pass==password) && (user==username)

    {
        cout<< "Access Granted"<<endl;
    }
    else{
        cout<< "username And Password Incorrect"<<endl;
    }
    cout << "Hello world!" << endl;
    return 0;
}

it says there is a problem with the if statement

3
Contributors
2
Replies
19
Views
2 Years
Discussion Span
Last Post by zelrick
0

Hello Sir directorabbey;

  1. Add #include <string>

  2. Transfer the:

const string password = "123";
const string username = "abc";

before int main()

  1. On your if statement add () like this

if ((pass==password) && (user==username))

That would work. Cheers!

-zelrick

Edited by zelrick

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.