Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > The Community > Chit Chat

GoogleCommunity Sponsor

Reply
 
LinkBack Thread Tools Display Modes
Old 05-28-2009, 05:01 AM   #1 (permalink)
Googler
 
Join Date: Dec 2008
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
wolfyy1 is on a distinguished road
Switch Statement

Code:
 
#include <iostream.h>
#include <iomanip.h>
void main()
{
     int shippingmethod;
     double shippingcost;
 
     cout<<"How do you want the order shipped?\n";
     cout<<"1- Ground\n";
     cout<<"2- 2-day air\n";
     cout<<"3= Overnight air\n";
     cout<<"4- Carrier Pigeon\n";
     cout<<"Enter the number of the shipping method you want: ";
     cin>>shippingmethod;
 
     switch(shippingmethod)
     {
          case 1:
               shippingcost=5.00;
               break;
          case 2:
               shippingcost=7.50;
               break;
          case 3:
               shippingcost=10.00;
               break;
          case 4:
               shippingcost=230.00;
               break;
          default:
               shippingcost=0;
               break;
     }
 
     if (shippingcost==0)
     {
          cout<<"Illegal selection--no result calculated"<<endl;
     }
 
     else
     {
          cout.setf(ios::fixed);
          cout<<"Add $"<<setprecision(2)<<shippingcost<<" to the order total to cover shipping cost."<<endl;
     }
}

Last edited by wolfyy1; 05-28-2009 at 05:03 AM.
wolfyy1 is offline   Reply With Quote
 
Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch between windows? Rockin Introduce Yourself 0 05-02-2008 08:59 AM
Forum Software Switch? intelliot GC Announcements 30 07-14-2006 01:31 AM
Why switch? ajordan Gmail Forum 16 07-04-2006 06:20 AM
search line switch 9BallNinja Search Engine Optimization Forum 0 03-07-2006 11:06 AM


All times are GMT -8. The time now is 04:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community