cout<<"\n Input name and sales " ;
if (sales<15000)com=0;//if sales is below 15t com is 0
//if sales between 15t to 25t com is 1500+10% of sales that exceeds 15000
//if sales is 25t up com is 3000+10% of sales that exceeds 15000
cout<<"\n the commission is " <<com;
it runs but i am not sure if the output is right... thanks in advance...
Look closely at my post. Does it say else (sales>25000) or else? It just says "else", doesn't it? else statements don't allow a condition because it wouldn't make sense. It's just the part that is executed if all the other conditions were false.
As an aside, prefer this style
over this style
if (condition) statement;
The first one improves readability and doesn't give the more experienced programmers the desire to smack you over the head with a C++ manual, so it's a win-win situation.
I am Rammohan from Bangalore and working as a Technical lead in big IT firm . Solution for your answer is follows:
The way you have coded is wrong. Compiler cannot choose the sales value is in which level. You need to write the code as follows:
else if (15000<25000)
Commission = (sales-15000)*.1+1500;
Commission = sales-25000*.1+1500;
Regards, Rammohan Alampally,
www.FindSyntax.com -> Worlds first Web based Windows O/S is a Brain Chaild of Rammohan
Oh my god, what the hack should that be? It isn't april the 1st on my calendar. And the statement elseif (15000<25000)
is a code joke at best, and not even a funny one. By the way, this forum doesn't support signatures, for which I'm quite grateful. So please stop you futile attempt to create attention by putting them in manually.