0

why when I run it ....the output of the "if" statements doesn't come up ...Im trying to see if theres any erros but I just cant find anything please any help I would appreciated

include <iostream>
#include<iomanip>
using namespace std;
int main()
{

char size;
cout<<"******************Welcome to M&D Pizza House*****************\n";
cout<<" What size pizza do you want ? (s = small; m = medium; l = large): ";
cin>>size;

if(size == 's' && size == 'S')

cout<<" Size:	Small";

else if (size == 'm' && size == 'M')
cout<<" Size:	Medium";

else if(size == 'l' && size == 'L')
cout<<" Size:	Large";

return 0;
}
4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by alg
0

Hi,

Use "or" not "and" in if statement

if(size == 's' || size == 'S')
0
if(size == 's' || size == 'S')
	cout<<" Size:	Small";

else if (size == 'm' || size == 'M')
	cout<<" Size:	Medium";

else if(size == 'l' || size == 'L')
	cout<<" Size:	Large";

Edited by alg: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.