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.

How To Make A Password?

+1 vote
asked Nov 12, 2018 by Marshall (390 points) 1 flag
Hey guys just wondering if anyone knew how to code a password in c++

2 Answers

+1 vote
answered Nov 12, 2018 by Ryan White (160 points)
Here's my best solution:

#include <iostream>

#include <string>

using namespace std

int main() {

     string password;

     cout<<"Enter the password:\n";


     if (password == "whatever the correct one is here") {


          //then put whatever code you want to run here

     } else {



          //if the password was incorrect, the program ends.

0 votes
answered Nov 12, 2018 by anonymous
here is my answer in c language

int main(){
    char a[6];
    printf("Device Unlocked");
        printf("Incorrect 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.