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;

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

if (choicecolor == '1')
else if (choicecolor=='2')
else if (choicecolor=='3')
cout<<"invalid output"<<endl;

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

return 0;

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.