#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
const size=3;
class item
{
private:
char name[25];
int qty;
float rate,amount;
public:
void getdata()
{
cout<<endl<<"Enter the item name:";
cin>>name;
cout<<"\nEnter the Rate:";
cin>>rate;
cout<<"\nEnter the Quantity:";
cin>>qty;
}
void printdata()
{
cout<<setw(5)<<name;
cout<<setw(5)<<rate;
cout<<setw(5)<<qty;
amount=rate*qty;
cout<<setw(8)<<amount<<endl;
}
};
void main()
{
item shop[size];
clrscr();
for(int i=0;i<size;i++)
shop[i].getdata();
cout<<"Shopping List"<<endl;
cout<<"Name Quantity Rate Amount\n";
for(i=0;i<size;i++)
shop[i].printdata();
getch();
}
#include<conio.h>
#include<iomanip.h>
const size=3;
class item
{
private:
char name[25];
int qty;
float rate,amount;
public:
void getdata()
{
cout<<endl<<"Enter the item name:";
cin>>name;
cout<<"\nEnter the Rate:";
cin>>rate;
cout<<"\nEnter the Quantity:";
cin>>qty;
}
void printdata()
{
cout<<setw(5)<<name;
cout<<setw(5)<<rate;
cout<<setw(5)<<qty;
amount=rate*qty;
cout<<setw(8)<<amount<<endl;
}
};
void main()
{
item shop[size];
clrscr();
for(int i=0;i<size;i++)
shop[i].getdata();
cout<<"Shopping List"<<endl;
cout<<"Name Quantity Rate Amount\n";
for(i=0;i<size;i++)
shop[i].printdata();
getch();
}
Bulshit
ReplyDeleteBulshit
ReplyDeleteit has one error
ReplyDeleteNothing wrong save it as .cpp instead of c then try
DeleteGot correct out put no error
ReplyDelete.
ReplyDeleteI am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing. 성인용품창업
ReplyDeleteIt has error😡😡😡
ReplyDeleteI am happy with the program no errors found
ReplyDeleterate needs to be given by program itself not by user
ReplyDelete