(I apologize if there's something wrong with my post as this is my first one...)
So my teacher gave this as a sample output:
:
And this is my code:
#include <iostream>
using namespace std;
int main() {
//variables
string name;
int fries = 0, burger = 0, donut = 0, ic = 0, sd = 0;
const float friesp = 80, burgerp = 150, donutp = 30, icp = 25.50, sdp = 20;
int pricef = 0, priceb = 0, priced = 0, pricei = 0, prices = 0;
float total = 0, vat = 0, bill = 0;
//name of customer
cout<<"Hi! Please type your name.";
cin>>name;
//amounts
cout<<"Please enter the amount of fries ordered:";
cin>>fries;
pricef = fries*friesp;
cout<<"Please enter the number of burger(s) ordered:";
cin>>burger;
priceb = burger*burgerp;
cout<<"Please enter the number of donut(s) ordered:";
cin>>donut;
priced = donut*donutp;
cout<<"Please enter the number of ice cream ordered:";
cin>>ic;
pricei = ic*icp;
cout<<"Please enter the number of soft drink(s) ordered:";
cin>>sd;
prices = sd*sdp;
//bill formula
total = pricef+priceb+priced+pricei+prices;
vat = total*0.20;
bill = total + vat;
//prices
cout<<"Hi "<<name<<"! Here is the summary of your order:""\n";
cout<<fries<<""<<" fries "<<friesp<<" "<<pricef<<"\n";
cout<<burger<<""<<" burger(s) "<<burgerp<<" "<<priceb<<"\n";
cout<<donut<<""<<" donut(s) "<<donutp<<" "<<priced<<"\n";
cout<<ic<<""<<" ice cream "<<icp<<" "<<pricei<<"\n";
cout<<sd<<""<<" soft drink(s) "<<sdp<<" "<<prices<<"\n";
//billing
cout<<"Subtotal:"<<total<<"\n";
cout<<"20% VAT:"<<vat<<"\n";
cout<<"Total bill:"<<bill<<"\n";
return 0;
}
I think I got the gist of it however, I do not know to to add the space in between my outputs. These spaces are what I want to achieve but don't know how...