Dev C++ Spacing Problem

This is a discussion on Dev C++ Spacing Problem within the C++ Programming forums, part of the General Programming Boards category; Hello! I am a big fan of Dev C++ (I grew up coding with it), but I am having frustrating ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    3

    Angry Dev C++ Spacing Problem

    Hello!

    I am a big fan of Dev C++ (I grew up coding with it), but I am having frustrating spacing difficulties. Every time I press the TAB key, it advances a random number of spaces (usually very large). I will look back at my code to find that none of it is aligned properly (and even it it were, the big spaces would make it ugly). Is there any way to fix this, or is there something that I am doing wrong?

    I apologize for asking such a dumb question.

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    when you tab, it goes to the next space on the line before

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    3

    =)

    I see that you are correct, thank you for explaining. ^_^

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    There is an IDE option called "Smart tabs" (or something like that). Uncheck it, then you'll get better spacing.

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    I just hit space three times for every indent. I find doing it manually will produce the best results. But if I am using MSVC++2003 it automaticly indents for me.
    I'm just trying to be a better person - My Name Is Earl

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    I just hit space three times for every indent.
    Maybe I should try it. As of now I'm producing very deeply nested code blocks with little or no concern as to the consequences... should I be?
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  7. #7
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    Code:
    Maybe I should try it. As of now I'm producing very deeply nested code blocks with little or no concern as to the consequences... should I be?
    I am no C++ expert, but I would take small concern at this. Later, when you or another person wants to review or change any of your code, he/she may find it hard to follow without good indentation practice included.

    My guess would be to review what you have done and make small changes here and there. If you begin a new program/project, indent to a rule of three spaces per code block ect. If you keep all the indents to the same spacing size, your code will look nicley formatted.
    I'm just trying to be a better person - My Name Is Earl

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Go to the editor options by:
    Tools -> Editor Options

    Under the General tab:
    Check: Auto Indent
    Uncheck: Use Tab Character and Smart Tabs
    Look for the edit box called Tab Size and make the number your preferred indent size.

    This should allow you to use the Tab key. It will also autoindent whenever a brace is entered (the next line will be indented).

    Note: you can play with these settings to get the desired feel. Some may prefer the have Use Tab Character checked.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Output spacing problem
    By boxsterh in forum C++ Programming
    Replies: 4
    Last Post: 02-16-2006, 03:24 PM
  2. Replies: 5
    Last Post: 11-07-2005, 10:34 PM
  3. Problem running prog I wrote in Dev C++
    By KidMan in forum C Programming
    Replies: 8
    Last Post: 09-22-2005, 01:50 AM
  4. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21