My teacher said that i should go to
Tools → Options → Text Editor → C/C++ → Tabs
put 4 in for "Tab size", and 4 in for "Indent size" If you pick 4, then you should select "Keep tabs". I think he also said that VS will line up the code when it saves.
My code is formatted horribly. Do i have to do this by hand?
Code:
bool list::remove (const char * const name)
{
//search for the data to be removed
node * prev = NULL;
node * curr = headByName;
while (curr)
{
if(strcmp(curr->item.getName(), name) == 0)
{
//remove the data
if(!prev)
headByName = curr->nextByName;
else
prev->nextByName = curr->nextByName;
delete curr;
return true;
}
prev = curr;
curr = curr->nextByName;
}
return false;
}
to something like:
Code:
bool list::remove (const char * const name)
{
//search for the data to be removed
node * prev = NULL;
node * curr = headByName;
while (curr)
{
if(strcmp(curr->item.getName(), name) == 0)
{
if(!prev)
headByName = curr->nextByName;
else
prev->nextByName = curr->nextByName;
delete curr;
return true;
}
prev = curr;
curr = curr->nextByName;
}
return false;
}