| | |
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: 223 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll dynamic encryption error file forms fstream function functions game givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort stream string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






