Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

C++


  • Please log in to reply

#1
stumpy187

stumpy187

    New Member

  • Member
  • Pip
  • 1 posts
I have been set and assignment which i have the basic structure of what the thing should be like.
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>

int minutesused, rental, prepaidminutes, paidmins, minscost, totalcost, totalmins;
char tariff[1];

void main(){
cout<<"Enter the Tariff: ";
cin>>tariff;
cout<<"Enter Minutes call time used this month: \n";
cin>>minutesused;

if (tariff == "A" || tariff == "a")
        rental = 0;
        prepaidminutes = 0;
if (tariff == "B" || tariff == "b")
        rental = 4.00;
        prepaidminutes = 50;
if (tariff == "C" || tariff == "c")
        rental = 7.25;
        prepaidminutes = 100;
if (tariff == "D" || tariff == "d")
        rental = 12.75;
        prepaidminutes = 200;
if (tariff == "E" || tariff == "e")
        rental = 20.00;
        prepaidminutes = 400;

if (minutesused > prepaidminutes)
        paidmins = minutesused - prepaidminutes;

if (paidmins <= 10)
        minscost = paidmins * 0.10;
else if (paidmins <= 30)
        minscost = 3.00 + (paidmins - 10) * 0.2;
else
        minscost = 7.00 + (paidmins - 30) * 0.1;

totalcost = rental + minscost;

cout<<setw(15)<<"Call Cost "<<char(156)<<minscost<<"\n";
cout<<setw(15)<<"Rental "<<char(156)<<rental<<"\n";
cout<<setw(15)<<"Total Cost "<<char(156)<<totalcost<<"\n";

getch();
}
It is a mobile phone tariff.
it asks for the tarif and the minutes u have used then gives out the final monthly cost includin the minutes that where free.
the only thing is that i cant seem to get it to work
it asks for everythin but doesnt do any working out and the final stage finishes with no prices.
btw im using Borland C++
  • 0

Advertisements


#2
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
we do not do homework on this site.

here are some tips.

1. get familiar with the index of your text book
look up 'if' and read how to use curly braces {}

2. the following link has links to C++ tutorials
http://www.geekstogo...07&hl=tutorials

3. search the net for c++, examples, if
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP