CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    70

    Bracket Confusion

    Hello, i am mostly used to programming in visual basic 6. As you know this is a huge change from c++. My biggest problem with learning C++ is the brackets. I no that you can go through your program to find out which brackets correspond with what but i find it extremely confusing.

    If you cannot understand what im talking about ive put some code below.




    {
    code
    {
    more code
    }
    code
    {
    {
    }
    {


    I know that makes no sense. But basically with a lot of if statements i find it extremely hard to find out which "sub" it is referring to. When i was in java the program i was using would highlight the corresponding bracket. I found this extremely useful. How do you guys deal with this? did you just learn to figure it out or is there some option i can turn on.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Bracket Confusion

    First, if the code is indented, then it should be easier.
    Code:
    {
      code
      {
         more code
      }
      code
      {
        {
        }
      }
    }
    Anyway, AFAIK Visual Studio does this highlight too. Though I'm not 100% sure, since I always use Visual Assist which definitely does it.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Jul 2008
    Posts
    70

    Re: Bracket Confusion

    Visual Studio highlights the first bracket or paren when you enter the last one. It just makes it bold it isn't vey distinguishable but it works.

    But the real solution is like Cliu says. Indent properly and it becomes pretty trivial.

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