#include <iostream>
usingnamespace std;
int main()
{
int code;
cout<<"Please insert resistor code.\nCode\t: ";
cin>>code;
switch(code)
{
case 0:
cout<<"Colour\t: Black"<<endl;
break;
case 1:
cout<<"Colour\t: Brown"<<endl;
break;
case 2:
cout<<"Colour\t: Red"<<endl;
break;
case 3:
cout<<"Colour\t: Orange"<<endl;
break;
case 4:
cout<<"Colour\t: Yellow"<<endl;
break;
case 5:
cout<<"Colour\t: Green"<<endl;
break;
case 6:
cout<<"Colour\t: Blue"<<endl;
break;
case 7:
cout<<"Colour\t: Violet"<<endl;
break;
case 8:
cout<<"Colour\t: Gray"<<endl;
break;
case 9:
cout<<"Colour\t: White"<<endl;
break;
default:
cout<<"Resistor code should be 0-9."<<endl;
}
system ("Question1");
return 0;
}
Our problem is that when we key in character to the program, our computers give us different outputs.
This is the output from my computer
Please insert resistor code.
Code : w
Resistor code should be 0-9.
Please insert resistor code.
Code : y
Resistor code should be 0-9.
Please insert resistor code.
Code : a
Resistor code should be 0-9.
Please insert resistor code.
Code :
And this is the output from my friend's computer
Please insert resistor code.
Code : w
Colour : Red
Please insert resistor code.
Code : y
Colour : Red
Please insert resistor code.
Code : a
Colour : Red
Please insert resistor code.
Code :
On my computer, my code is working correctly, but on my friend's computer, my code is not working well. I would like to know what actually happened?