Making page name and password

//So far this what I did now I want to make output like this if the choice of the pagename is this the password will be this. I just need to figure it out only that page password will come on out put not all of them. That would be really kind of you If you can help me out Thanks



#include<iostream>
using namespace std;


if('a');
{cout<<"password = 123456 \n";}

if('b');
{cout<<"password = 1234 \n";}

if('c');

{cout<<"password = 123 \n";}

if('d');
{cout<<"password = 123456789 \n";}

return 0;
}
Last edited on
If I am not mistaken, you may want to setup the password results like so:

if(choice == 'a');
{cout<<"password = 123456 \n";}

else if(choice == 'b');
{cout<<"password = 1234 \n";}

else if(choice == 'c');
{cout<<"password = 123 \n";}

else if(choice == 'd');
{cout<<"password = 123456789 \n";}

A switch menu would work best for this however,

switch(choice)
{
case 'a' :
cout<<"password = 123456 \n";
break;

case 'b':
cout<<"password = 1234 \n";
break;

case 'c':
cout<<"password = 123 \n";
break;

case 'd':
cout<<"password = 123456789 \n";
break;

default:
cout << "invalid input\n";
}
thank you so much
You're welcome! Glad that was some help, don't forget to mark your thread as being answered :)
Topic archived. No new replies allowed.