I need help with this C++ problem the output needs to look like this
Input:
Name: SavvyCustomer
Price: 50.95
Data Price: 15.50
Years: 4
Output: SavvyCustomer
Plan years: 4
Normal Price: $50.95
Discount Price: $29.45
% Change in Price:42%
Price w/30GB:$66.45
Discount Price w/30GB: $44.95
% Change in Price w/30GB:32%
My code is this and it isn't fully right i don't think can anybody help me.
int main()
{
int years;
double data;
double price = 0;
//float prices = 1;
char name[] = "Brandon";
cout << "Name: ";
cout << name << endl;
cout << "Price: ";
cin >> price;
cout << "Data Price: ";
cin >> data;
cout << "Years: ";
cin >> years;
cout << endl;
cout << name;
cout << "\nPlan Years: " << years;
cout << "\nNormal Price: " << price;
cout << "\nDiscount Price: " << (years - 2) * 10.75;
cout << "\n% Change in Price: " << setprecision(2) <<(price - data) / price ;
cout << "\nPrice w/30GB: " << setprecision(5) << (price + data);
cout << "\nDiscount Price w/30GB: " << setprecision(5) << (years - 2) * 10.75 + data;
cout << "\n% Change in Price w/30GB: " << setprecision(2) << ((price + data) - price) / (price + data);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire