when user input a character and press enters to take next input, output window asks to press any key and exit, please help me out to get remaining code working,
Here is the code
char r, R;
char c;
int channels;
int resedential()
{
// float channelscost = costperchannel*channels;
// float Bill = channelscost+processingfee+basiccost;
// cout << "Dear Customer Here is Your Bill" <<" "<<Bill<<endl;
}
int main()
{
cout << " Enter Customer Type" << " " << endl;
cin >> c;
if( c == r || R )
{
cout << " Enter Customer Type" << " " << endl;
cin >> c;
}
}
One thing I recognise, is that your if statement doesn't do what you think it does. Right now you aren't checking if c is equal to R.
Fixed Code:
if(c == r || c == R)
{
cout << "Enter Customer Type " << endl;
cin >> c;
}
Also check that there are actual values in r and R. So it doesn't compare to a constant (char(0))
– ASCII code NUL, resulting from default initialization of file-scoped variables to zero.
Example:
char r = 'A';
char R = 'B';