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

Thread: C++/C conversion to just C

Threaded View

  1. #27
    Join Date
    Aug 2009
    Posts
    439

    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 01: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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center