Thread: Can someome help me with a program please?

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    60

    Can someome help me with a program please?

    This is for class and I DO NOT want you to write it for me. I msised 2 days being really sick and do not see anything explaining this in the book. <i>Using C++ An Introduction to Programming</i>. I just want someone to get me on the right track.

    Purpose:
    Write a first C++ program that uses variables, integer calculations and formatting of output.
    Due Date: The program is due by 2p.m. on Friday 9/22/06
    Assignment:
    Read Chapter 3 and go over the slides under Course Documents.
    Write a C++ program using the cscilinux2 server and name it a3YourLastname.cpp ( for example – a3smithfield.cpp). The program should prompt the user to enter the integer number of an amount of money in dollars. The program should calculate the minimum number of 50 dollar bills, 20 dollar bills, 10 dollar bills, 5 dollar bills and 1 dollar bills in the original amount of money. Sample run of the program is below:

    Enter an amount of dollars: 177


    In $177 there are:

    $50 bills : 3

    $20 bills : 1

    $10 bills : 0

    $ 5 bills : 1

    $ 1 bills : 2



    Notes:

    i. The user should be able to input any integer number above between 0 and 300 and the program should calculate the correct output.

    ii. Coding style counts: You need to add comments including: your name, CSCI 1010 Section 03, Programming Assignment 3, Date Due, Purpose of the program.

    iii. HINT: Use the modulus operator % to calculate remainders

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    60
    okay i was wrong, im really stuck. here is what i have so far:

    #include<iostream>
    using namespace std;

    int main ()
    {
    int amt, fif, fifr, twe, twer, ten, tenr, five, fiver, one;
    cout << "Enter amount of dollars:" << endl;
    cin >> amt;
    fif = amt/50
    fifr = amt%50
    cout << fif << endl;
    cout << fifr << endl;
    return 0 ;
    }


    and it should compile even though i havent used the other int's

    here is the error message:

    in function 'int main()'
    syntax error before '=' token

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Code:
    fif = amt/50;
    fifr = amt%50;

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    60
    haha, im an idiot, thanks much, sorry about the sloppy code posting, next time it will be tagged

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM