Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculator v1
#6
(12-03-2009, 04:18 PM)Master of The Universe Wrote: +



(12-03-2009, 11:01 AM)Xenocide Wrote:
Code:
while(option<1 || option>4);
while(option!=4)
You see that, those two loops are almost the same.
You could easy put that all in one loop

Code:
while(option > 4) {
    switch(option) {
        // cases 1 to 4
        // case 1:
        // do();
        // break;
        default:
            return 1;
    }
}

The default part would execute on every number that's not in the range from 1-4, so no need for option < 1 and the second while loop.
So you can use the default to call the selection menu again.
Alright thanks man Thumbsup
Reply


Messages In This Thread
Calculator v1 - by Brainless Control - 12-03-2009, 11:01 AM
RE: Calculator v1 - by Gaijin - 12-03-2009, 12:57 PM
RE: Calculator v1 - by Brainless Control - 12-03-2009, 02:06 PM
RE: Calculator v1 - by MrD. - 12-03-2009, 02:28 PM
RE: Calculator v1 - by Gaijin - 12-03-2009, 04:18 PM
RE: Calculator v1 - by Brainless Control - 12-04-2009, 02:14 AM
RE: Calculator v1 - by Brainless Control - 12-05-2009, 05:02 AM
RE: Calculator v1 - by MrD. - 12-05-2009, 07:48 AM
RE: Calculator v1 - by Brainless Control - 12-05-2009, 08:04 AM
RE: Calculator v1 - by MrD. - 12-05-2009, 08:16 AM
RE: Calculator v1 - by Brainless Control - 12-05-2009, 08:20 AM
RE: Calculator v1 - by M4X1MU5 - 12-12-2009, 05:24 AM
RE: Calculator v1 - by nextlive - 12-24-2009, 08:01 AM
RE: Calculator v1 - by Brainless Control - 01-09-2010, 07:23 AM
RE: Calculator v1 - by MrD. - 01-09-2010, 06:03 PM
RE: Calculator v1 - by Brainless Control - 01-10-2010, 03:37 AM
RE: Calculator v1 - by Gaijin - 01-10-2010, 03:43 AM
RE: Calculator v1 - by Brainless Control - 01-10-2010, 05:48 AM
RE: Calculator v1 - by Gaijin - 01-10-2010, 05:58 AM
RE: Calculator v1 - by Brainless Control - 01-10-2010, 06:05 AM
RE: Calculator v1 - by Brainless Control - 01-16-2010, 04:12 PM
RE: Calculator v1 - by Equinøx - 01-18-2010, 10:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Multi Purpose Calculator Reality 21 5,116 12-14-2010, 06:11 PM
Last Post: Buzz Lightyear
  my own calculator WHITE PANDA 8 2,193 07-14-2010, 03:19 PM
Last Post: Kondry
  Calculator in C Liberty 4 1,320 12-10-2009, 11:45 PM
Last Post: Sagittarius

Forum Jump:


Users browsing this thread: 4 Guest(s)