C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 14th, 2012, 12:30 PM
Qas242m Qas242m is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 Qas242m User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 11 sec
Reputation Power: 0
General - Always ouputs zero... but that is never the required answer???

#include <iostream>
#include <iomanip>

using namespace std;
double distanceInMiles, variableShippingCost, FixedShipmentCost;

void calculateVariableCost()
{
int firstTierCost, secondTierCost, thirdTierCost;

firstTierCost = 5;
secondTierCost = 4;
thirdTierCost = 3;

if (distanceInMiles < 0)
{
cout << "ERROR: The distance should be a positive value.";
}
if (distanceInMiles >= 0) (distanceInMiles <= 100);
{
variableShippingCost = firstTierCost*distanceInMiles;
}
if (distanceInMiles > 100) (distanceInMiles <=500);
{
variableShippingCost = (100 * 5) + ((distanceInMiles - 100)*secondTierCost);
}
if (distanceInMiles > 500)
{
variableShippingCost = (100 * 5) + ((distanceInMiles - 100)*4) + ((distanceInMiles - 500)*thirdTierCost);
}
}

int main()
{
cout << "Enter the distance in miles: ";
cin >> distanceInMiles;
calculateVariableCost;
cout << "The cost of shipment over ";
cout << distanceInMiles;
cout << " miles is ";
cout<< variableShippingCost;
cout << "\n";
}

Reply With Quote
  #2  
Old November 14th, 2012, 07:34 PM
ediz ediz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 102 ediz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 35 m 33 sec
Reputation Power: 3
Whne you call a functon, use ().


calculateVariableCost();

Reply With Quote
  #3  
Old November 14th, 2012, 09:45 PM
Ruthie512 Ruthie512 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 6 Ruthie512 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 12 sec
Reputation Power: 0
--------------------------------------

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - Always ouputs zero... but that is never the required answer???


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap