954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Simple C++ Program for billing

By Rajeesh.N.Santhu on Dec 13th, 2010 4:25 pm

Simple C++ program for billing
NB:Excuse me experts,,,,,This is only for beginners


1.copy and paste the program in a notepad
2.save the textfile with .cpp extension
3.select file type all
4.cut the textfile and paste it in your bin folder where turbo c is located
5.open turbo c and open the document we just saved in bin
6.if opened,press F9 to compile and then ctrl+F9 to run...
7.search the bin folder for the .exe format file with the name you given for the text
file......use it further........
try it!!!!!!!!!!!!!!!
Its your friend....
Rajeesh.N.Santhu

#include<iostream.h>
#include<conio.h>
float no,price[50],total[50],qty[50],tt;
char item[30];
void main()
{
int i,j;
clrscr();
cout<<"\n\n\t\t\tRaje's Billing Software\n\n";
cout<<"\nEnter The Number of Products you'v Purchased:";
cin>>no;
cout<<"\n\nSL No\tITEM NAME\tQUANTITY\tPRICE/ITEM\n\n";
for(i=1;i<=no;i++)
{
cout<<i;
cout<<"\t";
cin>>item;
cout<<"\t";
cin>>qty[i];
cout<<"\t";
cin>>price[i];
total[i]=price[i]*qty[i];
cout<<"\n\n";
}
for(i=1;i<=no;i++)
{
tt=tt+total[i];
}

cout<<"\n\n\t\t\tTOTAL:"<<tt<<" Rupees";
cout<<"\n\n\t\t\tTHANK YOU VISIT AGAIN.....";
getch();
}

I'm sorry to tell you, but this code is just horrible; people should never ever use this snippet.

1. void main() does not exist in standard C++
2. neither does iostream.h or conio.h. They are only used by Turbo C which is only used by people from India and the Philippines for some reason. The rest of the world uses IDE's from this millennium.
3. Global variables. Yuck.
4. No indention. Double yuck.
5. neither getch() or clrsrc() are valid C++ functions
6. No error control on input what-so-ever.

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You