Please i need help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please i need help.

i got an assignment to write a code that will allow user to recharge credit on his phone, and the user can send credit to someone too. My question is how can i add if a user recharge from $50 upwards to get a bonus of $10? Thank you guys #include <iostream> using namespace std; int main() { float AddRecharge=20, CreditTransfer, Amount; int balance, phone; char option; cout << "Select the following options \n"<<endl<<"Press 1 to recharge your phoone or\n"<<endl<<"Press 2 to transfer credit"<<endl; cin >> option; switch (option) { case '1': cout<< " Enter the Amount to would like to recharge " <<endl; cin>> Amount; if (Amount >= 10) { balance = AddRecharge + Amount; cout<< " Your current recharge balance is "<< endl << balance <<endl; break; } else { cout<< " Error!!! You cannot recharge less than $10"<<endl; break; } case '2': cout << "Enter the phone number you would like to send credit to" <<endl; cin >> phone; cout << "enter the amount"<<endl; cin >> Amount; CreditTransfer = AddRecharge - Amount; cout<<"Your transfer was successfull"<< endl << phone << endl << "Your current recharge balance is"<<" "<<CreditTransfer; break; } }

24th Nov 2020, 4:16 PM
Jabir
Jabir - avatar
1 Answer
+ 1
Thank you so much Martin Taylor
24th Nov 2020, 7:49 PM
Jabir
Jabir - avatar