C Board  

Go Back   C Board > Community Boards > General Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 06-07-2006, 07:43 PM   #1
Registered User
 
Join Date: Jan 2006
Posts: 100
setting indentation in dev-c++

I know this has been covered before, but I can't get dev-c++ to do indentation. I have tried the obvious things like: Tools, editor options. But whatever I try, I can't get it to do decent indentation.
By default, it makes things look like your writing in MS Word.
Code:
if(x)

{

printf();

}
And the closing brace for the body of main() never wraps around like other compilers. Anyone know how to set this stuff??
richdb is offline   Reply With Quote
Old 06-07-2006, 08:14 PM   #2
Registered User
 
Join Date: Mar 2006
Posts: 726
Tools -> Editor Options -> Auto Indent.
__________________
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;}
jafet is offline   Reply With Quote
Old 06-07-2006, 08:18 PM   #3
Registered User
 
Join Date: Jan 2006
Posts: 100
I already have that selected, but it doesn't change anything.
richdb is offline   Reply With Quote
Old 06-07-2006, 09:00 PM   #4
Moderately Rabid
 
Decrypt's Avatar
 
Join Date: Feb 2005
Location: Milwaukee, WI, USA
Posts: 300
What is your tab size set to?
__________________
There is a difference between tedious and difficult.
Decrypt is offline   Reply With Quote
Old 06-10-2006, 08:22 AM   #5
Registered User
 
Join Date: Jan 2006
Posts: 100
It is set to 2. But playing with it doesn't seem to help. The code doesn't indent in the places it should, and braces don't wrap correctly either. When I write a loop, it comes out looking like this:

Code:
for()

{

printf();

}
or this:

Code:
for()

{
        printf();

                       }
And the closing brace for main() stays in the middle of the page.
richdb is offline   Reply With Quote
Old 06-10-2006, 08:49 AM   #6
Even death may die...
 
Dante Shamest's Avatar
 
Join Date: Apr 2003
Location: Malaysia
Posts: 970
Here are my settings that seem to work okay for me.

Auto Indent: checked
Use Tab Character: not checked
Smart Tabs: not checked
Keep Trailing Spaces: checked
Backspace Unindents: checked
Enhanced Home Key: checked
Dante Shamest is offline   Reply With Quote
Old 06-10-2006, 10:59 AM   #7
Registered User
 
Join Date: Jan 2006
Posts: 100
That's alot better.

Code:
#include <stdio.h>

main()

{
  int  a=2,
  b=10,
  c=1,
  d=5;
  
  while(a < b)
  
  {
    printf("\ntest");
    ++a;  
  }
  
  if(a==b)
  {
    printf("\n\ntest2");
    --a;
  }
  
  else
  {
    ++c;
    ++d;
  }
    getchar();

}
But as you can see, the declarations of int don't line up, and the "else" part doesn't indent after the "if". Maybe these things can't be changed, I'm just used to using visual studio where the formating and indentation was automatic and comfortable. Here you get that left justified look on everything.
richdb is offline   Reply With Quote
Old 06-12-2006, 10:03 AM   #8
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
Wasn't there a way to select a block of code and press tab or shift tab and it changes the entire indent for that block?
indigo0086 is offline   Reply With Quote
Old 06-12-2006, 08:03 PM   #9
Registered User
 
Join Date: Jan 2006
Posts: 100
Yeah, but other compilers do it automatically when you type certain keywords.
richdb is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New to Dev C++/<windows.h>... Cilius C++ Programming 3 02-23-2005 01:05 AM
Glut and Dev C++, Programs not Quitting? Zeusbwr Game Programming 13 11-29-2004 08:43 PM
Dev C++ Compiler, Indentation? Zeusbwr C++ Programming 3 10-21-2004 06:13 AM
openGL programming - From MSVC++ to Dev C++ WDT Game Programming 1 03-08-2004 05:19 PM
Your favourite fantasy game setting? fry Game Programming 4 10-16-2002 06:26 AM


All times are GMT -6. The time now is 11:33 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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