Here is a very simple program which is actually not working properly in Dev c++;
When i compile the program it shows 0 errors,yet it doesn't run completely.
Whreas if i run the same one in Borlan c++ it runs to completion,no problem.
What to do such that it works properly n Dev c++.
#include<iostream.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
class Deparmental
{
char Prod_name[50],Dis_type;
int long Listprice,Distprice; int Net;
void Cal_price()
{
int percent;
if (strcmp(Prod_name,"Washing Machine")==0)
Listprice=12000;
if (strcmp("Colour Television",Prod_name)==0)
Listprice=17000;
if (strcmp(Prod_name,"Refrigerator")==0)
Listprice=18000;
if (strcmp(Prod_name,"OTG")==0)
Listprice=8000;
if (strcmp(Prod_name,"CD Player")==0)
Listprice=4500;
if(Dis_type=='F')
percent=17;
if(Dis_type=='N')
percent=10;
Distprice=(Listprice*percent)/100;
Net=Listprice-Distprice;
}
public:
int Accept()
{
cout<<"\n WELCOME TO CUSTOMER BILL GENERATION PROGRAM";
cout<<"\n Enter product name ";
gets(Prod_name);
cout<<"\n Enter product discount type ";
cin>>Dis_type;
Cal_price();
return 0;
}
int ShowBill()
{
cout<<"\n BILL ";
cout<<"\n Product purchased "<<Prod_name;
cout<<"\n Net price "<<Listprice;
cout<<"\n Dicount price "<<Distprice;
cout<<"\n Net price after deduction "<<Net;
return 0;
}
};
int main()
{
Deparmental A;
A.Accept();
A.ShowBill();
return 0;
}