Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 1314

c++ newbie question.

by vafer - 23 March, 2020 - 03:16 PM
This post is by a banned member (vafer) - Unhide
vafer  
Registered
140
Posts
62
Threads
4 Years of service
#1
(This post was last modified: 23 March, 2020 - 03:17 PM by vafer.)
So I wanted to ask you if its possible to write this code (posted bellow) in different way.
Without the do-while loop.

(the code)

https://pastr.io/view/WzC946qRL2d

Thank you for your time.
This post is by a banned member (Assembly) - Unhide
Assembly  
Registered
249
Posts
7
Threads
4 Years of service
#2
Code:
cout << "Please input your password: ";
cin >> password;


if (password == "foobar")
{
cout << "Correct" << endl;
}


!= Means not equal too so in the code you put it would display the welcome message whenever the user put the wrong password instead of the right password

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)