struggling with the strings!!

Hi guys,
I have a headache for the last two days because of this program, I tried everything i could think of. I tried constant variables too and I just can't get it to work. so please help good people.


#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;

int main()
{
char choicefurniture;
char choicecolor ;
string furniturecode ="";
string furniturecolor="";
string furniture ="";

cout<< " Enter 1 for chair or 2 for table"<< endl;
cin >> choicefurniture;
cout << " Enter 1 for red, 2 for black or 3 for green"<<endl;
cin>>choicecolor;

if (choicefurniture=='1')
{ furniturecode=="c47";
}
else if (choicefurniture=='2')
{furniturecode=="t47";
}

if (choicecolor == '1')
{furniturecolor=="42";
}
else if (choicecolor=='2')
{furniturecolor=="25";
}
else if (choicecolor=='3')
{furniturecolor=="30";
}
else
cout<<"invalid output"<<endl;

furniture= furniturecode + furniturecolor;
cout<< "Inventory code: "<< furniture <<endl;

system("pause");
return 0;
}


Thanks.
You're using an == to assign a value. == is a comparison operator, like you used int he if/else if statement. To assign a value, you need to use only one equal sign.
Thanks a lot. I appreciate it.
Topic archived. No new replies allowed.