indentation

what can I do to make the following display correctly on this forum, with the correct spacing and indentation:
void CircleList::add(string s)
{
Player p;
p.name=s;
if(count==0) // no players at the table
{
// special case: adds a player to an empty table
playerArray[0]=p;
count=1; // adds the first player
whoWasLastToPlay=0; // whoWasLastToPlay at pos 0
}
else
{
for(int i=count-1; i>=whoWasLastToPlay+1; i--)
{
playerArray[i+1]=playerArray[i];
}
playerArray[whoWasLastToPlay+1]=p;
count++;
}
}
code tags

[code]your program here[/code]
you mean open with square braquet, and close with square braquet? I hope you don't mind I will try it here!!
[void CircleList::add(string s)
{
Player p;
p.name=s;
if(count==0) // no players at the table
{
// special case: adds a player to an empty table
playerArray[0]=p;
count=1; // adds the first player
whoWasLastToPlay=0; // whoWasLastToPlay at pos 0
}
else
{
for(int i=count-1; i>=whoWasLastToPlay+1; i--)
{
playerArray[i+1]=playerArray[i];
}
playerArray[whoWasLastToPlay+1]=p;
count++;
}
}]
Topic archived. No new replies allowed.