What is wrong with this code?

#include <iostream>

main(){

int Password = 0;
int Name = 0;
int b = 0;
int a = 0;

std::cout << "Enter name here\n";

std::cin >> Name;

std::cout << "Enter password here \n";

std::cin >> Password;

if(i == Password && b == Name );

std::cout << "You're in";

else() {

std::cout << "Wrong password & or name\n";
std::cout << "Try again";

while( i != Password | b != Name ){ 



}   



}

It would help us even more if you included the kind of error you are getting.

E:

  1. You are trying to save a String (Name, Password) to an integer
  2. When you open an if statement you also need curly brackets { }
  3. Inside the if statement you have an i variable that has neither been declared nor initialized.
  4. While loop needs a block of code inside to do something.
  5. Inside the while loop you have an i variable that has neither been declared nore initialized.
1 Like