I have to make a program in C format and language that uses
I have to make a program in C++ format and language that uses \" if else if\" statement to do the following: Ask the user how much money he or she is willing to spend, display the availiable products the user can buy with the amount they input. They only have 4 products which are: comic book $1, sports journal $2, science book $15, and novel up to $10. The program should say: \"With that amount you can buy ,\"list of products\". For example, it should say, \"You can buy comic book $1 and sports journal $2. Please help!
Solution
#include <iostream>
using namespace std;
int main(void){
int amount;
cout << \"Enter the amount to spend:\";
cin >> amount;
cout << \"With that amount you can buy\ list of products\"<< endl;
if(amount >=15){
cout << \"Sceince book,novel,sports journal and comic book\"<< endl;
}
else if(amount >= 10){
cout << \"novel,sports journal and comic book\"<< endl;
}
else if(amount>=2){
cout << \"Sports journal and comic book\"<< endl;
}
else if(amount>=1){
cout << \"comic book\" << endl;
}
return 0;
}
/*
sample output
Enter the amount to spend: 20
With that amount you can buy
list of products
Sceince book,novel,sports journal and comic book
*/
