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.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
a program to accept a password from user
–1
vote
asked
Apr 30, 2018
by
anonymous
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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;
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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 "); }
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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";
}
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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.
...