Jump to content


Check out our Community Blogs

fread

Member Since 23 Nov 2008
Offline Last Active Nov 08 2013 08:56 AM
-----

#615678 while loop repeating itself

Posted by fread on 30 November 2011 - 02:08 PM

while(choice=='Y')//while user enters yes then get the price and weight

    {

      cout<<"\nPlease enter the price of the item";//outputs price

      cin>>price;//reads price input

      cout<<"\nPlease enter the weight of the item";//outputs weight

      cin>>weight;//reads the weight from user

      bTax+=price;//calculates price to total

      totalWt+=weight;//calculates total weight

      cout<<"\nEnter information on an item? Y or N";



    /* change the value of choice whilst you are in the while loop; any where within these curly brackets will be ok */

     choice = 'N';

    }

  • -1


#614282 Card dealing exercise.

Posted by fread on 16 November 2011 - 06:25 AM

I don't see the need either. You return the position of the first available card, which as you state is the purpose of the function. The other information does not add to the problem and changes your i value, unless we are missing something. :confused: Put you code in code tags next time. Use the # sign.
code goes here

  • -1


#614212 What's the easiest way of reading text files?

Posted by fread on 15 November 2011 - 05:43 PM

In the simplest sense you can think of the exceptions like this. You are about to do 'something' with compilable code that can possibly go wrong and crash your program or the results may be undefined. So you need to put the code in a try block. Now if the 'something' goes wrong, then what? The catch block steps in here to do whatever analysis and recovery you need to do. You can use the finally block to do cleanup work, like closing connections, etc.
  • -1


#446005 New To Programming

Posted by fread on 22 March 2009 - 04:27 AM

Excellent choice! Its very popular and you will get a lot of help, especially here. Basic tools a good book or two, a compiler, preferably one with an ide (like dev), google and codecall and your off at a great start. The guys here seem to recommend Thinking in C++ a lot. Its available for download. Have fun!
  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download