#include<iostream.h>
class invent2
class invent1
{
	int code;
	int items;
	float price;
	public:
	  invent1(int a,int b,float c)
	  {
  		code=a;items=b;price=c;
  	}
  	void putdata()
  	{
	  	cout<<"code:"<<code<<"\n";
	  	cout<<"items:"<<items<<"\n";
	  	cout<<"value:"<<price<<"\n";
	  	
  	
 	}	int getcode(){
	  		return code;
	  	}
	  	int getitems()
	  	{
	  		return items;
	  	}
	  	float getprice()
	  	{
	  		return price;
	  	}
	  	operator float(){
	  		return(items * code);
	  	}
};

class invent2
{
	int code;
	float value;
	public:
	 invent2()
	 {
 		code=0;value=0;
 	}
 	invent2(int x,float y)
 	{
	 	code=x;
	 	value=y;
	 }
	 void putdata()
	 {
 		cout<<"code:"<<code<<"\n";
 		cout<<"value:"<<value<<"\n";
 	}
 	invent2(invent1 p)
 	{
	 	code=p.getcode();
	 	value=p.getitems();
	 }
 };
 
 int main()
 {
 	invent1 s1(100,5,140.0);
 	invent2 d1;
 	float total_value;
 	 
	 total_value=s1;
	 d1=s1;
	 cout<<"product details - invent1 type"<<"\n";
	 s1.putdata();
	 cout<<"stock value"<<"\n";
	 cout<<"value ="<<total_value<<"\n";
	 cout<<"product details-invent2 type"<<"\n";
	 d1.putdata();
	 return 0;
	 
 }

multiple types in one declaration.what does that error mean?? i got error in line 34

Recommended Answers

All 2 Replies

You have a missing semicolon ; at the end of line 2.

Cheers for now,
Jas.

thank you JH :*

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.