Why is my code not working? | Sololearn: Learn to code for FREE!

+1

Why is my code not working?

Hey guys! I’m fairly new here and new to C++. I’m trying to create a program that compares two integers. However, i keep getting errors when trying to run the code? Can I get extra eyes on this? #** hidden … next part in comments

c++

1/24/2022 10:58:51 PM

Annei ❤️

8 Answers

New Answer

+7

'else' doesn't need any condition. The statement inside it will execute if all defined conditions doesn't match

+3

I am soooo grateful, thank you all!

+2

What are you trying to assing to "number"? As it is,, it's always going to be 0.

+2

Maybe if this happens in the future and for example there's a statement saying you need to "calculate a team winning 38 games and 3 games are a tie, ties give out 3 points and wins give out 10 points, put this as a code" maybe just put everything in one bracket, that helped me.

+1

Remove the word int from your if statements.

0

No need to declare x and y again and again and else is written without any condition

0

Because it has error😁

0

I'm late to the post, but welcome to the Solo Learn community! It's actually a great place to learn a lot. The community is very helpful and pleasant. There are a lot of very knowledgeable people, so make sure you ask lots of questions! Gave you your first upvote on your posted question as well as your comment do you could get the achievements for both. Good luck out there!