Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string password;
- cin >> password;
- if (password == "s3cr3t!P@ssw0rd") {
- cout << "Welcome" << endl;
- }
- else {
- cout << "Wrong password!" << endl;
- }
- return 0;
- }
- Решение с тернарен оператор:
- #include <iostream>
- using namespace std;
- int main() {
- string password;
- cin >> password;
- cout << (password == "s3cr3t!P@ssw0rd" ? "Welcome" : "Wrong password!") << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement