"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain

Friday, January 29, 2010

Write a program to prepare the invoice from the following data :

customer number
customer name and address
date of sale, description
quantity
unit price
discount percentage
sales tax percentage

===================================================


#include<iostream.h>
#include<conio.h>
#include<stdio.h>

struct date{
int day;
int mon;
int yr;
};

struct invo{
int cust_num;
char cust_nm[20];
char add[40];
date D_O_sale;
char descp[30];
int quan;
int unit_pr;
float discount;
float sales_tax;
};

void main()
{
invo Customer[10];
char c;

for(int i = 0; i< 10; i++)
{
cout<< "\n Enter the customer no.";
cin>> Customer[i].cust_num;

cout<< "\n Enter the Customer name :";
gets( Customer[i].cust_nm);

cout<< "Enter Date of Sale (dd-mm-yy):";
cin >> Customer[i].D_O_Sale.day >> c >>  Customer[i].D_O_Sale.mon >>  c >> Customer[i].D_O_Sale.yr ;

cout<< "\n Enter Description :";
gets( Customer[i].descp);

cout<< "\nEnter Quantity : ";
cin>> Customer[i].quan;

cout<< "\n Unit Price ?";
cin >> Customer[i].unit_pr;

cout<<"\n Discount :";
cin >> Customer[i].discount;

cout<<"\n Sales Tax :";
cin>> Customer[i].sales_tax;

}

clrscr();

cout<<" \n Customer Num.     Customer Name \t Address \t Date-of-Sale    Desc \t Quantity    Unit Price   Discount%   Sales-Tax% \n\n";

cout<<"================================================================ "

for( i = 0; i< 10; i++)
{
cout<< Customer[i].cust_num << "   "  << Customer[i].cust_nm << "\t" << Customer[i].add << "\t" << Customer[i].D_O_sale.day<<"-"<<  Customer[i].D_O_sale.mon << "-" << Customer[i].D_O_sale.yr << "    "<< Customer[i].descp << "\t" <<  Customer[i].quan << "   "<<   Customer[i].unit_pr << "    "<<  Customer[i].discount << "    "  << Customer[i].sales_tax << endl ;
}

getch( );
}

No comments:

Post a Comment

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Now Playing: Ballade Pour Adeline

About Me

My photo
I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.