c++ program to create an item with two private num int and float cost with two public functions

/*WAP to create a class item with two private variable
 number -int
 cost -float
 and two public function void getdata() and void putdata()

using namespace std;
class item
int number;
float cost;
void getdata();
void putdata();

void item::getdata()
cout<<“Enter the number : “;
cout<<“Enter the cost”;

void item::putdata()
cout<<“Number : “<<number;
cout<<endl<<“Cost : “<<cost;

int main()
item m;
return 0;


Enter the number : 9
Enter the cost65.5
Number : 9
Cost : 65.5

Leave a Comment

Your email address will not be published. Required fields are marked *

Hire a server Expert to resolve the issue Now.

Hire a server Expert to resolve the issue Now.

Resolve this issue in just 5$ from https://serverexpert.io


You have Successfully Subscribed!

Open chat