Hi to DaniWeb. I've been checking out the forums from time to time to get help with C++. I'm a total beginner in C++, the only other language I have any knowledge of would be HTML, which is getting old. Anyways, I'm in a class that is requiring an assigment using the switch. When using the switch, can the statements in the case statements be whatever code statements you want executed if that respective choice is selected, or just simple cout statments?, (this is what I have in mind)
switch(process_choice)
{
case 1: // menu choice 1 - process transaction selected
customer_no++; // customer_no accum
cout << "Customer #: "<< customer_no << endl; // display Customer number/transaction
cout << endl;
cout << "Please enter customer type (I-Internet, L-Local) : " << endl; // Select Customer Type I or L
cin >> customer_type;
cout << endl;
switch(customer_type) // decision making process for customer type (discout or shipping charges)
{
case 'i':
case 'I':
if(total_sales_int < 50.00)
{
shipping = 3.00; // declaration of shipping charge for this sale amount
final_charge_int = total_sales_int + shipping; // final charge for internet customer
}
else
shipping = 0.00;
break;
case 'L':
case 'l':
/* Loop for local customer discount calculation BEGIN */
if(tot_chg_pre_disc > 60.00)
{final_charge_loc = (tot_chg_pre_disc + (tot_chg_pre_disc * DISC_10));}
if((tot_chg_pre_disc > 30.00) && (tot_chg_pre_disc < 59.00))
{final_charg_loc = (tot_chg_pre_disc + (tot_chg_pre_disc * DISC_5));}
break;
/* Loop for local customer discount calculation END */
default:
cout << endl << endl;
cout << "You Entered an Incorrect Response. Try Again!" << endl;
break;
}
case 2:
cout << "you really don't know what you're doing" << endl;
break;
default:
cout << "You Entered an Incorrect Response. Try Again!" << endl;
break;
}
If I should add any more information to my post please feel free to tell me. I'm a total novice at this. I just need a few pointers. The assignment deals with decision making, focusing on using the if, if-else, and switch statements. We are to write a program that displays a menu that asks us to either process Local or Internet customers (with a local discount program & and a shipping charge for Internet customers) or to display an overall report. The products sold are 4 books. I don't know why I just wrote all that, maybe to give whoever reads that part of the code an idea. I'm not looking for step by step help or anything like that, just if whats in my code is correct, almost correct, way off, or whatever you know. Enough rambling.
Any help would be appreciated. Thanks
TG