The program ignores the "If" statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

The program ignores the "If" statement

#include <iostream> using namespace std; int main() { int a; cout << "If Mihnea is the best select 0, if not press anything else"; cin >> a; if (a = 0) { cout << "You know what you know, and you know it right!"; } if (a >= 1) { cout << "In this moment, you are joking, or you are really dumb."; } return 0; } Some help? Cause i can run the program but the programs after the "If" doesn't trigger.

19th May 2017, 12:08 PM
Dr. Clef
Dr. Clef - avatar
26 Answers
+ 22
// Replace with : if(a == 0)
19th May 2017, 12:13 PM
Dev
Dev - avatar
+ 18
@C0MPL3X Well, it happens! 😉
19th May 2017, 12:17 PM
Dev
Dev - avatar
+ 12
lol
19th May 2017, 12:50 PM
manoj katari
manoj katari - avatar
+ 5
wow rarely to see Brother and Sister have a unity with each other xD
19th May 2017, 12:21 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 3
@Dayve O crap I totally forgot about == and ='s!
19th May 2017, 12:14 PM
Complex
Complex - avatar
+ 3
It's okay everybody makes a mistake too :D (Pro Tip: Even a pro makes more than one error :P)
19th May 2017, 12:16 PM
Complex
Complex - avatar
+ 3
:D
2nd Jul 2017, 2:20 PM
Complex
Complex - avatar
+ 3
Just reviewed your codes! Nice! :D It was all awesome codes
2nd Jul 2017, 2:22 PM
Complex
Complex - avatar
+ 2
try replacing this: if (a = 0) { //code } else if (a >= 1) { //code }
19th May 2017, 12:09 PM
Complex
Complex - avatar
+ 2
Hmm let me see.
19th May 2017, 12:12 PM
Complex
Complex - avatar
+ 2
Thank you
19th May 2017, 12:14 PM
Dr. Clef
Dr. Clef - avatar
+ 2
It worked!
19th May 2017, 12:14 PM
Dr. Clef
Dr. Clef - avatar
+ 2
Dayve: "You're welcome ;)" It totally wasn't me Good luck on your coding :)
19th May 2017, 12:15 PM
Complex
Complex - avatar
+ 2
@Dayve Totally xD
19th May 2017, 12:17 PM
Complex
Complex - avatar
+ 2
@Green Magic Production We already red/rad(read)/rod(What the heck is the past tense) it, but it was nice of you, you made her a code :) Nothing is odd here, I actually make wierd codes (Especially some that I thought it works, but doesnt)
19th May 2017, 12:21 PM
Complex
Complex - avatar
+ 2
lmao
19th May 2017, 12:39 PM
Complex
Complex - avatar
+ 2
@Corrupted_Data Holy cow! I just saw this man, was busy, I'll rate it :D
2nd Jul 2017, 2:19 PM
Complex
Complex - avatar
+ 1
It still doesn't work
19th May 2017, 12:11 PM
Dr. Clef
Dr. Clef - avatar
+ 1
It doesn't trigger
19th May 2017, 12:11 PM
Dr. Clef
Dr. Clef - avatar
+ 1
Let me try
19th May 2017, 12:13 PM
Dr. Clef
Dr. Clef - avatar