Thread: C-Program Project - Help!!!

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    2

    C-Program Project - Help!!!

    Hey everybody, I have an assignment to create a simple program to calculate the prices of airline tickets. Basically, I want it to ask for the departure airport, the arrival airport, the distance between airports, the fuel price and number of persons traveling on the flight. So basically it would calculate the ticket price by multiplying the distance(which would be in miles) by the fuel needed per mile(which would be a constant value) and dividing that by the fuel price. Then that value would be divided by the number of persons traveling on that flight. It would then display the price of a ticket from that departure airport to the destination. Please, help me!!! I'm completely lost.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well you have a list of inputs, so how about writing the program which asks say "How many passengers" (and all the others), and reads in values into suitably named variables (like numPassengers).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    2
    Yea.. I'm asking for help writing the program. Cause I dont have a clue how

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Study the C tutorial:
    Cprogramming.com Tutorial: Introduction to C

    and give it a go.

    We won't get you started on your program - the tutorial will show YOU how to do it. When you get stumped, then post the code you've written so far, and tell us what has you stumped.

    Then it's a C issue, and we can assist. Until you have some C code, it's really a YOU issue, and YOU need to get cracking on it.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Surely you must have some "clue" about printf ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Third Eye Babkockdood's Avatar
    Join Date
    Apr 2010
    Posts
    352
    We're not here to do your homework for you. Read around the internet, read man pages, and don't be afraid to experiment. You'll figure it out.
    Quote Originally Posted by The Jargon File
    Microsoft Windows - A thirty-two bit extension and graphical shell to a sixteen-bit patch to an eight-bit operating system originally coded for a four-bit microprocessor which was written by a two-bit company that can't stand one bit of competition.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Free program I'm sharing: ConvertEnumToStrings
    By Programmer_P in forum Projects and Job Recruitment
    Replies: 101
    Last Post: 07-18-2010, 12:55 AM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM