Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

a program to accept a password from user

–1 vote
asked Apr 30, 2018 by anonymous

3 Answers

0 votes
answered May 1, 2018 by KW
#include <iostream>
#include <string>
using namespace std;

int main()
{   
    string pw;
    string error = "Sorry invalid password";     
    
    cout <<"Hello Enter your password" << endl;
    cin >> pw;
    
    if (pw == "liv4love"){
        cout << "Welcome to control panel";
        } else {
           cout << error << " .......ACCESS DENIED!";
        }

    return 0;
}
0 votes
answered May 3, 2018 by nav (150 points)
#include<stdio.h>                                                                                                                                                          main()                                                                                                                                                                             {                                                                                                                                                                                              int pin=0000,count;                                                                                                                                                    while(pin==0000) {                                                                                                                                                      (count>3);                                                                                                                                                               printf("enter pin : ) ;                                                                                                                                                     scanf("%d",&pin); }                                                                                                                                                       if(pin!=0000)                                                                                                                                                              { printf(" incorrect pin try again :");                                                                                                                                scanf("%d",&pin);  }                                                                                                                                                   else{ printf(" welcome user ");  }
0 votes
answered May 7, 2018 by kranthi (140 points)
#include <iostream>
#include <string>
using namespace std;
main()
{
  string pw,p;
cout<<"create your password";
cin>>pw;
cout<<"enter your password";
cin>>p;
if(pw = p){
cout<<"welcome user";
}
else{
cout<<"sorry wrong password";
}
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...