no match for operator>> in std:: cout
Dec 1, 2014 at 4:03am UTC
I keep getting a no match for operator>> in std:: cout... i dont understand why. i've searched and cant seem to understand what the responses to other posts similar to mine mean...
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
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string programCode = "" ;
string furnColor = "" ;
cout << "Choose a Furniture Type: " ;
cout << "Please Enter C for chair or T for table:" ;
cin >> programCode;
cout << "Choose furniture color:" ;
cout >> "Please enter R for red, B for black or G for Green:" ;
cin >> furnColor;
programCode[i]= toupper(programCode[i]);
furnColor[i]= toupper(furnColor[i]);
if (programCode[0] == 'C' || furnColor[0] == 'R' )
{
cout << "Product Code: C4741" << endl;
}
else if (programCode[0] == 'C' || programCode[0] == 'B' )
{
cout << "Product Code: C4725" << endl;
}
else if (programCode[0] == 'C' || programCode[0] == 'G' )
{
cout << "Product Code: C4730" << endl;
}
else if (productCode[0] == 'T' || productCode[0] == 'R' )
{
cout << "Product Code: T4741" << endl;
}
else if (productCode[0] == 'T' || productCode[0] == 'B' )
{
cout << "Product Code: T4725" << endl;
}
else if (productCode[0] == 'T' || productCode[0] == 'G' )
{
cout << "Product Code: T4730" << endl;
}
else
{
cout << "Invalid choice of furniture type or color." << endl;
}
system("pause" );
return 0;
}
Dec 1, 2014 at 4:18am UTC
Line 16: Your cout operator is the wrong direction (>>). Should be <<.
Line 19,20: i is undefined.
Line 34,38,42: productCode is undefined.
Topic archived. No new replies allowed.