Error: expected unqualifiedid message
Hi,
I am having trouble getting the following code to execute. Just need to figure out what I am doing wrong. Any suggestions?
error: expected constructor, destructor, or type conversion before '>>' token
error: expected unqualifiedid before 'if'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

#include <iostream>
using namespace std;
int units_sold;
int total_cost_wout_discount;
int discount_rate;
int main()
//Get number of units sold
cout << "Enter amount of units sold:" << endl;
cin >> units_sold;
//Calculate purchase before discount and input validation statement
if (units_sold > 0)
units_sold * 99.00 == total_cost_wout_discount
else
{
cout << "Please start program again and enter a quantity greater than zero";
}
//Determine and display final cost after %20 discount rate
if (units_sold => 10 && 19 <=)
discount_rate = total_cost_wout_discount *.20
{
cout << "Your final cost including 20% discount is" << total_cost_wout_discount  discount_rate << endl;
}
//Determine and display cost after %30 discount rate
else if (units_sold => 20 && 49 <=)
discount_rate = total_cost_wout_discount *.30
{
cout << "Your final cost including 30% discount is" << total_cost_wout_discount  discount_rate << endl;
}
//Determine and display final cost after %40 discount rate
else if (units_sold => 50 && 99 <=)
discount_rate = total_cost_wout_discount *.40
{
cout << "Your final cost including 40% discount is" << total_cost_wout_discount  discount_rate << endl;
}
//Determine and display final cost after %50 discount rate
else if (units_sold => 100)
discount_rate = total_cost_wout_discount *.50
{
cout << "Your final cost including 50% discount is" << total_cost_wout_discount  discount_rate << endl;
}
//Determine and display final cost after no discount rate
else (units_sold <= 9 && >= 1)
{
cout << "Your total cost is" << total_cost_wout_discout <<endl;
}
return 0;
}

Normally that error means you have << going the wrong way:
std::cout >> "Other Way";
But you have some other errors:
You need a bracket here
and * does nothing (or at least here) what you want is *=

discount_rate = total_cost_wout_discount *=.20

Last edited on
Topic archived. No new replies allowed.