ugh ERROR!
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#include <iostream>
#include <string>
using namespace std;
string get_type()
{
const string C = "C47";
const string T = "T47";
string type;
cout << "Choose furniture type." << endl;
cout << "Please enter C for chair or T for table:";
cin >> s;
if (type == "C")
{
return C;
}
else if (type == "T")
{
return T;
}
else
{
return "";
}
string get_color()
{
const string Red = "41";
const string Black = "25";
const string Green = "30";
string color;
cout << "Choose funiture color." <<endl;
cout << "Please enter R for red, B for black or G for green:";
cin >> color;
if (color == "R")
{
return Red;
}
else if (color == "B")
{
return Black;
}
else if(color == "G")
{
return Green;
}
else
{
return "";
}
int main()
{
string furntype = get_type();
string furncolor = get_color();
if (furntype == "" || furncolor == "")
{
cout << "Invalid choice of furniture type or color" << endl;
}
else
{
cout << furntype + furncolor << endl;
}
}
return 0;
|
Last edited on
Review your error messages and proofread your code. . . you should find an uninitialized variable and some missing and misplaced brackets.
There's a lot to be said for indenting your code. . .not the least of which is proofreading.
i have proofread over and over, i've changed the brackets often, tried multiple ways, i can't seem to figure it out!
Fix the indentation in your code and repost it.
Hint: the return statement can only be inside of a function.
Topic archived. No new replies allowed.