From 61dce3529af81ec43e35c13fc8b91d551d2ff95b Mon Sep 17 00:00:00 2001 From: copycode69 Date: Mon, 16 Dec 2024 21:20:00 +0530 Subject: [PATCH 1/2] Replaced and with && --- 3-conditionals/17_voting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3-conditionals/17_voting.cpp b/3-conditionals/17_voting.cpp index dec5351..9ebaa34 100644 --- a/3-conditionals/17_voting.cpp +++ b/3-conditionals/17_voting.cpp @@ -8,7 +8,7 @@ int main() { bool citizen = true; bool registered = false; - if (age >= 18 and citizen == true and registered == true) { + if (age >= 18 && citizen == true && registered == true) { // Use '&&' instead of 'and' std::cout << "You can vote!\n"; } else if (age < 18) { From f759dc2c6fbda64602a06448d565259a97e37231 Mon Sep 17 00:00:00 2001 From: copycode69 Date: Mon, 16 Dec 2024 21:25:17 +0530 Subject: [PATCH 2/2] fix minor issue --- 3-conditionals/18_trivia_quiz.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/3-conditionals/18_trivia_quiz.cpp b/3-conditionals/18_trivia_quiz.cpp index 06e3607..abb3f03 100644 --- a/3-conditionals/18_trivia_quiz.cpp +++ b/3-conditionals/18_trivia_quiz.cpp @@ -10,7 +10,6 @@ int main() { int answer1; int answer2; - std::string answer3; std::cout << "Q1) What is the name of the world's longest river? 💧\n\n"; std::cout << "1) Missouri River\n"; @@ -33,12 +32,14 @@ int main() { std::cout << "3) 206\n"; std::cout << "4) 10\n"; - std::cin >> answer1; + std::cin >> answer2; - if (answer1 == 3) { + if (answer2 == 3) { std::cout << "You got it correct!\n"; } else { std::cout << "I'm sorry...\n"; } + + return 0; }