#include <iostream> //11
using namespace std;
enum itemcode { keyboard = 100,mouse,scanner,lase=200,inkjet,plotter };
void main() {
enum itemcode item;
cout << "Enter item code :";
cin >> item;
switch (item) {
case keyboard:
cout << "Keyboard.\n";
break;
case mouse:
Cout << "It's a mouse.\n";
break;
case scanner:
Cout << "Scanner.\n";
break;
case lase:
cout << "It's a laser printer.\n";
break;
case inkjet:
cout << "Inkjet printer.\n";
break;
case plotter:
cout << "I'm a plotter\n";
break;
default:
cout << "The item does not exist.\n";
}
}
Severity Code Description Project File Line Display Error (Suppression) Status Error (active) E0349 No ">>" operators match these operands.
What's the reason for the error?
c++
cout
does not correspond to all forms
Note) https://modoocode.com/213
In addition, in the above code, you can simply provide a buffer in an array and solve it with a case statement for the buffer.
© 2024 OneMinuteCode. All rights reserved.