jeudi 30 novembre 2017

cant put if statement in loop C++

I have an assignment for school, very simple, just ordering burgers from a joint and calculating the costs. I've tried to use an if statement to make sure the user likes their order, but it keeps giving me and error, whether my variable "yesorno" is a string or a char.

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int main() {
char yesorno;
int burgers, fries, drinks;
int i=0;
while (i=0) {
    cout<<"Aidan: 'Welcome to the Christopher Burger Joint!\nOur burgers are $4.00, fries are $2.50, and drinks are $1.50.";

    cout<<"\nHow many burgers will you be having today?";
    cin>>burgers;
    cout<<"\nHow many fries will you be having today?";
    cin>>fries;
    cout<<"\nand how many drinks for you today?";
    cin>>drinks;
    cout<<"\nSo here is your current order:\nBurgers: "<<burgers<<"\nFries: "<<fries<<"\nDrinks: "<<drinks;
    cout<<"Is this all?\nYes or No: ";
    cin>>yesorno;
    if (yesorno = "yes") {
        i=2;
    }

}
int grosstotal = (burgers*4)+(fries*2.5)+(drinks*1.5);
int tax = grosstotal*.12;
int total = tax+grosstotal;
cout<<"\nYour total before tax is $"<<grosstotal<<",\nYour tax is $"<<tax<<",\nAnd your total today is $"<<total<<".\nEnjoy!'";


return 0;
}

Aucun commentaire:

Enregistrer un commentaire