Here is my code:
Code:
//name
//CSCI 1010 Section 3
//Assignment 4
//9.28.06
//The purpose of this program is to price an entered number of shirts. More shirts means less cost per shirt.
#include<iostream>
using namespace std;
int main ()
{
int shirts, price;
cout << "Welcome to Expensive Shirts Dot Com!" << endl;
cout << "Enter the number of shirts you wish to purchase:" << endl;
cin >> shirts;
if (shirts < 0)
{
cout << "ERROR: You must enter a positive number. We only sell shirts. We do not buy them." << endl;
else if (shirts < 3)
{
price = shirts * 12;
cout << "Total cost of " << shirts << " shirts: $" << price << endl;
}
else if (shirts < 10)
{
price = shirts * 10;
cout << "Total cost of " << shirts << " shirts: $" << price << endl;
}
else if (shirts < 24)
{
price = shirts * 8;
cout << "Total cost of " << shirts << " shirts: $" << price << endl;
}
else if (shirts > 24)
cout << "Sorry, you cannot order more than 24 shirts." << endl;
}
return 0;
}
Here is the error message when i tried to compile:
Code:
a4xxxxxxxl.cpp: In function `int main()':
a4xxxxxxx.cpp:19: syntax error before `else'
a4xxxxxxx.cpp: At global scope:
a4xxxxxxx.cpp:37: syntax error before `return'