The c++ code coach of comment is not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

The c++ code coach of comment is not working

#include <iostream> using namespace std; int main() { // your account's balance auto balance = 2452.4; // price for each notebook auto price = 259.99; // Task: calculate the number of notebooks you can afford and output it. // Hint: use an integer to store the result. int notebooks = balance / price; cout << "Number of notebooks you can afford: " << notebooks << endl; // Task: calculate the amount left over on your account after the purchase and output it on a new line. // Hint: calculate the total price of the purchase, then subtract it from the balance. auto new_balance = balance - (notebooks * price); cout << "Amount left over after the purchase: " << new_balance << endl; return 0; }

28th Jan 2024, 1:17 PM
Garo Narsisian
1 Answer
+ 4
You are adding unrequested information (strings).
28th Jan 2024, 1:32 PM
Scott D
Scott D - avatar