I am finding it hard to understand conditional loops in c++ can you assist please?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am finding it hard to understand conditional loops in c++ can you assist please??

C++

19th Mar 2020, 3:17 PM
Makoye Ndalahwa
Makoye Ndalahwa - avatar
4 Answers
+ 1
int a = 5; if(a > 0) { std::cout<<"Greater than zero"; } else { std::cout<<"Smaller than zero"; } So the output would be Greater than zero because 5 is greater than 0.
19th Mar 2020, 3:22 PM
maf
maf - avatar
+ 2
maf im my own teacher.. so im doing this thing for fun
19th Mar 2020, 3:22 PM
Makoye Ndalahwa
Makoye Ndalahwa - avatar
+ 1
U have been ordered by your teacher to do homework, if you do you will get marks otherwise you will be punished. So we use if else statements to tell our program to do this if this happens or do that if that happens.
19th Mar 2020, 3:20 PM
maf
maf - avatar
+ 1
I learnt this myself too.
19th Mar 2020, 3:23 PM
maf
maf - avatar