CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 42

Threaded View

  1. #27
    Join Date
    Aug 2009
    Posts
    440

    Re: C++/C conversion to just C

    Set a break point at
    Code:
     int Finished = 0;
    and step from there. The problem should show up after a couple of steps. Also...your formatting for the switch statement...seems rather odd to me. I would do something like:

    Code:
                switch  (choice)
                { 
                    // accesses the functions
                    case 0: 
                        Finished = 1;                     
                        break;
                    case 1: 
                        addition(&reward);                
                        break;
                    case 2: 
                        subtraction(&reward);             
                        break;
                    default : 
                        printf("Error in input\n\n");   
                        break;
                }
    Sure, it is more lines of code, but imagine each of the cases requiring 10 instructions. I think the way I have it above would be more clear. But, that is just a personal preference.
    Last edited by Alterah; February 20th, 2012 at 02:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured