| | |
NO output for if statments
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 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
C++ Syntax (Toggle Plain Text)
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; }
0
#2 Nov 10th, 2009
Change the && to ||
1) Prove that the area of a circle is pi*r^2, where "r" is the radius of the circle. 2) Problem 2[b]solved by : jonsca
•
•
Join Date: Oct 2009
Posts: 7
Reputation:
Solved Threads: 3
0
#4 Nov 11th, 2009
Hi,
Use "or" not "and" in if statement
Use "or" not "and" in if statement
C++ Syntax (Toggle Plain Text)
if(size == 's' || size == 'S')
•
•
Join Date: Oct 2009
Posts: 7
Reputation:
Solved Threads: 3
0
#5 Nov 11th, 2009
C++ Syntax (Toggle Plain Text)
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";
Last edited by alg; Nov 11th, 2009 at 5:24 am.
![]() |
Similar Threads
- reading and manipulating console output (C++)
- how to use regex or an array to display some output from an arithmetic input? (VB.NET)
- Capturing Console Output (C)
- Why am I getting this output (C++)
- Help With SQL Server Agent (MS SQL)
- letter and word counter (C)
- Application Output Help (Java)
Other Threads in the C++ Forum
- Previous Thread: Queue/ Stack problem
- Next Thread: Helpnwith linked lists
Views: 228 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct studio temperature template templates text tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






