Oops; typo on the else from my previous message (else doesn't take a condition)...it's what happens to me when typing out code after a long day :). On 7/26/10, Dave <davidct1209@xxxxxxxxx> wrote: > You're missing closing right braces on the if/else if statements. > > You want the syntax to follow the pattern: > if (condition) > { > ... > } > else if (condition1) > { > ... > } > ... > else if (conditionN) > { > ... > } > else (finalcondition) > { > ... > } > > On 7/26/10, David Engebretson Jr. <d.engebretson@xxxxxxxxxxx> wrote: >> what's the exact error your compiler gives? >> >> thanks, >> david >> >> ----- Original Message ----- >> From: "Jes" <theeternalkid@xxxxxxxxx> >> To: <programmingblind@xxxxxxxxxxxxx> >> Sent: Monday, July 26, 2010 10:23 PM >> Subject: Re: If statements inside switch statements? >> >> >> Sorry it's taken me so long to get back. >> Bill, I am using C++. >> Here is the sample code that I am trying to compile: >> if (nights <= 0) >> { >> cout << "Error, must be greater than 0. "; >> else if (nights == 1) >> { >> cout << "You have selected to stay for a single night. "; >> else if (nights > 1) >> { >> cout << "You have selected to stay for "; cout << nights; cout << >> "nights. >> "; >> >> ] //end if >> >> >> On Jul 26, 2010, at 3:39 PM, Bill Gallik wrote: >> >>> Whoa, whoa, whoa; are you saying the "else" portion of your code doesn't >>> compile but the rest does? >>> >>> Which programming language are you using? >>> >>> If it's C or C++ send me a snippet of this code and I'll give it a look >>> because this doesn't seem plausible. >>> ---- >>> Holland's Person, Bill >>> E-Mail: BillGallik@xxxxxxxxxxxxxx >>> - The early bird may get the worm, but the second mouse gets the cheese! >>> __________ >>> View the list's information and change your settings at >>> //www.freelists.org/list/programmingblind >>> >> >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >> >> >> >> -------------------------------------------------------------------------------- >> >> >> >> >> Checked by AVG - www.avg.com >> Version: 8.5.441 / Virus Database: 271.1.1/3030 - Release Date: 07/26/10 >> 18:34:00 >> >> __________ >> View the list's information and change your settings at >> //www.freelists.org/list/programmingblind >> >> > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind