First things first: I know this code is overlong and could be shortened quite a bit. However, I don't want help with how to shorten it, I am just trying to understand some basics and my problem right now is with operators and storing values. As you can probably see from the code, I am trying to use a bunch of if statements to store specific values in variables and then display those values together in a string at the end. The compiler does not like my code and is giving me a bunch of operator related errors.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string type = "";
string color = "";
string invTypeCode = "";
string invColorCode = "";
string fullCode = "";
cout << "Use this program to determine inventory code of furniture.";
cout << "Enter type of furniture: ";
cin >> type;
if (type.length() == 1)
{
if (type == "1" or "2")
{
if (type == "1")
{
invTypeCode = "T47" << endl;
}
if (type == "2")
{
invTypeCode = "C47" << endl;
}
else
cout << "Invalid inventory code." << endl;
}}
else
cout << "Invalid inventory code." << endl;
cout << "Enter color code of furniture: ";
cin >> color;
if (color.length() == 1)
{
if (color == "1" or "2" or "3")
{
if (color == "1")
{
invColorCode = "41" << endl;
}
if (type == "2")
{
invColorCode = "25" << endl;
}
if (type == "3")
{
invColorCode = "30" << endl;
}
else
cout << "Invalid inventory code." << endl;
}}
else
cout << "Invalid inventory code." << endl;
fullCode = invTypeCode + invColorCode;
cout << fullcode << endl;
system("pause");
return 0;
}