cud sum1 pls correct da code or suggest ways such dat dis prog calculates da bill even if da items r chosen at random.....unlike now.....which calculates only when da items r entered in an order....
|
cout<<"\nenter the amount of the item u want to purchase";
|
cout<<"\nthe amount 2 b paid is:"<<amount2<<"\n";
|
LOL!!
That is 2 much :)
It could entertain me four hours!!
Good luck getting people to use such an "urban" software.
Anyway Sasha, thanks for da comedy :).
To be honest, there R some problems with "da code":
- don't use da conio.h header, it isn't from da standard C++ library, :)
It is bad because it is available only on Windows, so it makes ur code platform dependent
- because u can't use da conio.h header, u can't use da functions from conio.h
So don't use clrscr(), getch(), etc. :)
- don't use a chain of if else if else if, etc.No one will understand your code. Maybe not even u.
Dis way of programming is very bad.Instead of using a never ending chain of if else if... , use a
switch
statement instead.
- and da biggest problem of dem all: Don't use
void main()
.It's
int main()
:)
- also u forgot to specify da namespace.Either ypu specify it directly for each keyword, such as
std::cout
or u write
using namespace std;
before da main();
- is ur code C++ or C? If it is C++ than it's
#include<iostream>
.
iostream.h
is an old header.It doesn't even come with ur compiler.
- don't use variables names such as l. Is it "one", "el", or "ai"? You have a variable named l.It is "el" , but it's hard to tell
I hope that u understood what i said.As you can see, it's kind of hard, but very funny, to read such "urban" source code :).
Sasha, i hope you understand I wasn't making fun of you.If it appeared this way, than I apologise. Honestly, I wasn't trying to make fun of you. I was just making fun of "da situation".
Most of your problem come from using badly if else if else if,etc. statements.If you switch them with
switch
statements, then your code will be easy to understand.The way it is now, it doesn't even compile.