c++ help | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

c++ help

In introduction to c++, i'm at module 1 quiz The purpose of the quiz is, How much money will be left after buying the printer?, the program: int money = 1000; Int price = 145; Int result = money [ ] price; // ? - ? + ? * ? / ? % ? cout << result In this case, I think it's about subtraction, but when I write the minus symbol in the free space, it says that there is an error. So if somebody can help me i'll be glad ­čĄö.

19th May 2024, 10:33 PM
TRUTH
TRUTH - avatar
9 Antworten
+ 4
I think you should analyze more on the text ÔÇťleft over.ÔÇŁ It is not subtraction but it is still related to the topic discussed on this module. If you have 1000 and the printer costs 145, youÔÇÖll be able to buy 6 printers. The question is asking about how much money will be left if youÔÇÖve bought those 6 printers :> hint: what will you input to show a remainder from a division
20th May 2024, 4:30 PM
Nana Fish
Nana Fish - avatar
+ 5
I think you misread the question. Original text: Your company needs printers and provides $1000 to buy ***as many of the same printers as possible***. Your text: How much money will be left after buying ***the printer***?
20th May 2024, 1:05 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 3
TRUTH You got the right idea but you just have a syntax error. And yes, its subtraction. You forgot to add a semicolon for your cout << result; Also, not sure if its a syntax error but its best if you lowercase the ÔÇťIÔÇŁ for type int in your variables. https://sololearn.com/compiler-playground/ciXGM5sw1zTJ/?ref=app
19th May 2024, 11:12 PM
Junior
Junior - avatar
+ 3
What do you mean by ÔÇťcanÔÇÖt writeÔÇŁ?
19th May 2024, 11:49 PM
Junior
Junior - avatar
+ 3
TRUTH Different wording can lead to different result. Say you have $100 and want to buy as much candy as you can. Each candy cost $30. You can buy 3 candies and $10 left. If you buy a candy, you have $70 left.
20th May 2024, 8:41 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
Nana Fish % ­čĺÇ (i'm cooked in programming) thx after all <3.
20th May 2024, 5:13 PM
TRUTH
TRUTH - avatar
+ 1
Junior yes but i can write this mini program correctly in compiler but, i can't write in quiz so i can't pass, i don't know what's wrong with it, maybe a sololearn problem?
19th May 2024, 11:21 PM
TRUTH
TRUTH - avatar
+ 1
Junior seems like i can't normally explain so, try by yourself so u will see "what i can't write" ­čĺÇ
20th May 2024, 7:36 AM
TRUTH
TRUTH - avatar
+ 1
Wong Hei Ming no i just wanted to say in simple words.
20th May 2024, 7:37 AM
TRUTH
TRUTH - avatar