Thread: Programming Help

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    5

    Thumbs up Programming Help

    I'm just getting into C++ programming and I need some help getting these programs done here are the program problems:


    Program 1
    Write a program that will calculate the number of students going on a field trip to the zoo and the number going on a field trip to the museum. The information needed is contained in a data file named “trip.txt”. The data file contains the first name of each student and next to each student’s name is a 1 if the student is going to the zoo or a 2 if the student is going to the museum. Your program should calculate and print to the screen the total number of students going to the zoo and the total number of students going to the museum. Your program should contain at least one while loop.

    Place the following information in your data file.

    Here’s the data:
    Sam 1
    Tim 2
    Lou 1
    Scott 1
    Samantha 2
    Sara 2
    Lee 2
    Malik 1
    Kita 1
    Bob 1
    Sue 1
    Ming 2
    Tom 1
    Larry 1
    Bea 2
    Jay 1

    Program 2
    Write an interactive C++ program that accepts as input any two positive integers (the first integer should be less than the second integer). The program should determine and print all the odd numbers between the first integer and the second integer.

    For example, if 3 is input for the first number and the input for the second number is 20, the program would print:
    5
    7
    9
    11
    13
    15
    17
    19

    Your program should work for any two positive integers (the first integer should be less than the second integer).

  2. #2
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Might as well close this thread already. Read the rules or post some code wipper snapper!
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    5
    it will not let me post my tags

  4. #4
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    What? Copy and paste! It's not difficult!
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You need to post code between code tags. [code] code here [/code]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed