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

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    80

    Exclamation Please Help- my first program does something weird !

    hey,
    I just wrote my first program of my own.

    it works...
    but I can't figure out why if you guess the correct number you have to hit " quit " more than once to exit the program. If you guess the right number 4 times, you have to exit 4 times before it actually closes. can someone please point out in my code what is causing this ?

    thanks.
    here's my lame first written program.

    Code:
    #include <stdio.h>
    #include <conio.h>
    int r;
    int main()
    {
       
    
        int c=0;
          while(c <=9){
          printf("Print 10 !\n\n");
          ++c;
       }
           while(c=9){ 
          printf("want to re-print ? then you need to find the lucky number !\n\n if you get it wrong you will have to quit !");                
          scanf("&#37;d",&r);
          if(r!=4) break;
          else main();
          }
    
       { 
           printf("click any key to quit");
            
    }                                                     
    getche();
    
    }
    any help is appreciated !!

    Thanks
    Last edited by Jeff++; February 9th, 2009 at 06:29 PM.

Tags for this Thread

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