Q:

How to change indentation etc of a piece of code? 

Possible Duplicates:
Code polisher / reformater for C, C++ or Fortran
Best C++ Code Formatter/Beautifier 

I am working as part of a team on a C++ project.  Part of the code is a highly modified version of a large-ish external library, which doesn't conform to our coding conventions. 
The library uses this style:
void main ()
{
  if (somecondition)
    {
    doStuff (some, parameters);
    }
  moreStuff (parameter);
}

whereas our style is like so:
int main() {
    if(somecondition) {
        doStuff(some, parameters);
    }
    moreStuff(parameter);
}

(Also, the editor on Stack Overflow doesn't make it possible to show, but their code uses two spaces for indentation, our code uses tabs). 
Given that this is nearly all just editing whitespace, I'd imagine there are some programs to automate most of it. 

A:

There are lots of programs which do this for you.  Like:

Astyle (recommended)
Indent
Uncrustify
etc.  These are called "beautifers" or "pretty printers"

Some editors can also fix this stuff on run time, without modifying the actual source files. ( I believe Eclipse/emacs can do this)
Still, I can't help but ask why you wish to change the style of a library.