Thread: help with a program for school

  1. #16
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    Is it

    Code:
    total = total + (mem_card * num_of);
    anyone?

    total is a float and mem_card is a double. So the precision obtained in mem_card might be lost when assigning this new value to total.

    Try making total a double.

  2. #17
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    i was getting similar output, can't figure out why though, sorry.

    try this to get rid of the warnings...

    Code:
                const double mem_card = 69.95;
    	const double software = 34.98;
    	const double nw_pc = 675.00;
    	const double disk_drive = 198.50;
    	double total = 0;

  3. #18
    Registered User
    Join Date
    Nov 2001
    Posts
    255
    this is the new output and we got rid of the warnings lol ty very much


    How many items would you like to buy? 3
    Which items would you like to buy(Enter one item at a time then hit enter then t
    ype in how many you want to buy)?
    software
    That is an invalid choice.
    Which items would you like to buy(Enter one item at a time then hit enter then t
    ype in how many you want to buy)?
    That is an invalid choice.
    Which items would you like to buy(Enter one item at a time then hit enter then t
    ype in how many you want to buy)?
    That is an invalid choice.
    Your total is 0
    hooch

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