help please

The program i have come up with is giving me multiple errors, can someone help me fix it please.
Last edited on
Strings need double quotes, even inside comparison parentheses ( type == "constant" )
closed account (ypLhURfi)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<iostream>
#include<string>
//missing some (;).
//also can be done with string but a single letter.
//I have changed the string to char.
//char values ranging between ('').
using namespace std;

int main()
{
    string first = "";
    string last = "";
    const string invalid = "Invalid input";
    char type;
    char color;
    
    cout << "Choose furniture type" <<endl;
	cout << "Enter T for a table or C for a chair: " <<endl;
    cin >> type;
    
if (type == 'T')
{
	first = "T47";
}
else if (type == 'C')
{
	first = "C47";
}
else
{
	cout << "invalid choice of furniture type or color" <<endl;
}

cout << "Choose furniture color" <<endl;
cout << "Enter R for red, B for black or G for green" <<endl;
cin >> color;

if (color == 'R')
{
	last = "41";
}
else if (color == 'B')
{
	last = "25";
}
else if (color == 'G')
{
	last = "30";
}
else
{
	cout <<"Invalid choice of furniture type or color" <<endl;
}

cout <<"Product code: " << first + last <<endl;

	system("pause"); 
	return 0;
}
Last edited on
Kind of hard keeping track of where you are in this, trying to follow two different threads on the same subject.
Topic archived. No new replies allowed.