switch statement not working
May 21, 2011 at 5:23pm UTC
Switch statement isn't working no clue why.
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 60 61 62 63 64
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
double Tax(double first, double second)
{
return (first * second);
}
int main()
{
int choice;
cout << "1. Calculate Sales Tax " << endl;
cout << "2. Search orders" << endl;
cout << "3. Enter Customer Data" << endl;
cin >> choice;
switch (choice)
{
case 1: void salesTax(); break ;
case 2: void searchOrders(); break ;
case 3: void customerData(); break ;
}
}
void salesTax()
{
char filename[20], oNumber;
string YesNo;
double price, tax, total;
tax = .0625;
do
{
cout << "Price: " ;
cin >> price;
total = Tax(price, tax);
cout << "Original Price: " << "$" << price << endl;
cout << "Sales Tax: " << "$" << tax << endl;
cout << "==================================" << endl;
cout << "Total Amount: " << total + price << endl;
cout << "Do you want to calculate another items sales tax?"
cin >> YesNo;
}while (YesNo == "Yes" );
}
void searchOrders()
{
}
void customerData()
{
}
May 21, 2011 at 5:41pm UTC
1 2 3 4 5
case 1: void salesTax(); break ;
case 2: void searchOrders(); break ;
case 3: void customerData(); break ;
//"void" isn't needed here, and makes no sense in this context.
// If all you want to do is call a function then do that, ie: salesTax();
Last edited on May 21, 2011 at 5:41pm UTC
Topic archived. No new replies allowed.