Minesweeper game in win 32 console app..
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Minesweeper game in win 32 console app..

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Lightbulb Minesweeper game in win 32 console app..

    Hi every one This is my project in visual c++ 6.0
    .cpp file is attached check it out and leave your comments.
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Minesweeper game in win 32 console app..

    Stop naming your variables 'a', 'b', 'c'.. .etc. One letter variables are horrible and make it easy to make mistakes. Give them normal names like 'row' and 'column'.

  3. #3
    Join Date
    Aug 2009
    Posts
    3

    Re: Minesweeper game in win 32 console app..

    You are right and i'll consider it next time.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,295

    Re: Minesweeper game in win 32 console app..

    A couple of other minor suggestions:

    1) Put a little bit of white space in there. What's easier to read? This

    Code:
    for(int i=0;i<10;i++)


    or this

    Code:
    for( int i=0; i < 10; i++ )


    Be consistent in your formatting.

    2) Do your curly braces indent one level from the statement or not?

    Is it

    Code:
    for(int i=0;i<10;i++)
        {
     
        }


    or

    Code:
    for(int i=0;i<10;i++)
    {
     
    }


    Pick a style and stick with it. Formatting is very important because good, consistent formatting can help with code readability. And readability leads to maintainability.

  5. #5
    Join Date
    Aug 2009
    Posts
    3

    Re: Minesweeper game in win 32 console app..

    Quote Originally Posted by Arjay View Post
    A couple of other minor suggestions:

    1) Put a little bit of white space in there. What's easier to read? This

    Code:
    for(int i=0;i<10;i++)


    or this

    Code:
    for( int i=0; i < 10; i++ )


    Be consistent in your formatting.

    2) Do your curly braces indent one level from the statement or not?

    Is it

    Code:
    for(int i=0;i<10;i++)
        {
     
        }


    or

    Code:
    for(int i=0;i<10;i++)
    {
     
    }


    Pick a style and stick with it. Formatting is very important because good, consistent formatting can help with code readability. And readability leads to maintainability.
    very nice suggestions Arjay ,infact when I started writing this code I had in my mind to make the code as readable as possible, I had plan to add comments so that any one can easily understand it. But once I start writing, debugging and making algorithm for the code simultaneously I could'nt manage to stick with my plan and once I finished it I found it boring to decorate it
    anyways this was my first project I'll try to make my codes more readable next time.

    regards
    Last edited by emenent; September 1st, 2009 at 07:22 PM.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center