Click here to Skip to main content
15,903,834 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have this nested statement thats driving me crazy! Any help with thw bracket situation is much appreciated!

C++
if ( bShowTCP )
{
printf("\n -------------------- // -------------------- ");
printf("\n TCP Header:");
            				
int *addressValue = new int();
char *address = LIP; 
inet_pton(AF_INET, address, addressValue);
if (ip_header->source_ip == *addressValue)
{
printf("\n   Source      IP: %s", "0.0.0.0");
printf("\n   Destination IP: %s", ipDest);
}
else
{
printf("\n   Source      IP: %s", ipSrc);
printf("\n   Destination IP: %s", ipDest);
}
if (mysql_real_connect(conn,"urlock.db.5513143.hostedresource.com","VendorCheck","Reader1234","urlock",0,NULL,0) !=0)
{
(mysql_query(conn,"SELECT COUNT(*) FROM tblURL"));
my_ulonglong i = 0;
res_set = mysql_store_result(conn);
my_ulonglong numrows = mysql_num_rows(res_set);
LEGIT = mysql_fetch_row(res_set);
if (atoi(LEGIT[i]) == 1)
{
printf("PASS: %s\n",LEGIT[i]);
}
else
{
printf("FAIL: %s\n",LEGIT[i]);
}
else
{
printf("\n   Connect Failed!");
system("\n  PAUSE");
}
return 0;
}			   
}
break;
Posted

1 solution

That is why its good to indent code.
Then you will know exactly where one open open bracket ends.

If you're using Visual Studio you can try this -
Select the code that you want to indent.
Select Edit -> Advanced -> Format Selection.
 
Share this answer
 
Comments
Member 7766180 3-Aug-11 22:50pm    
Thank you so much! Problem solved! I never new about the Advanced/Format!
Good thing to know!
Sergey Alexandrovich Kryukov 3-Aug-11 23:43pm    
What a neuroleptic! :-) My 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900