473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why is the invalid letter not showing?

I wanna know why the program doesnt show "Invalid Letter Entered" when i enter any letter other than A S D or M

Expand|Select|Wrap|Line Numbers
  1. //Processing the data
  2.     if (letter== 'A'||'S'||'M'||'D')// checking Add, subtract, multiply or divide
  3.     {
  4.         if (letter== 'A')//Adding the integers
  5.             cout<<"Adding two integers = "<<first + second<<endl;
  6.         else if (letter== 'S')//Subtracting the integers
  7.         {
  8.             if (first < second)
  9.             cout<< "Subtracting two integers = "<<second - first<<endl;
  10.             else if (first > second)
  11.             cout<< "Subtracting two integers = "<<first - second<<endl;
  12.         }
  13.  
  14.         else if (letter== 'M')//Multiplying the integers
  15.             cout<<"Multiplying two integers = "<<first * second<<endl;
  16.         else if (letter== 'D')//Dividing the integers
  17.         {
  18.             if (first > second)
  19.             cout<< "Dividing two integers = "<<first/second<<endl;
  20.             else if (first < second)
  21.             cout<< "Dividing two integers = "<<second/first<<endl;
  22.         }
  23.     }
  24.     else
  25.         cout<<"Invalid Letter Entered"<<endl;
  26.     return 0;
Feb 29 '12 #1
1 1289
Rabbit
12,516 Expert Mod 8TB
It should be
Expand|Select|Wrap|Line Numbers
  1. if (letter== 'A' || letter== 'S'|| letter== 'M'|| letter== 'D')
Feb 29 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Alan J. Flavell | last post by:
OK, today's email brought a comment from a reader, pointing out something that I'd long since noticed myself but hadn't done anything about it. On my pages, I've got a first-letter style on...
5
by: Ron Brennan | last post by:
Good morning. I would like to use one or more RegExps to validate country names as having the first and last words beginning with an uppercase letter, intermediate words beginning with either...
33
by: Nigel Molesworth | last post by:
I've Googled, but can't find what I need, perhaps I asking the wrong question! I want a "FAQ" page on a web site, I hate those pages that scroll you to the answer so and I figured that a good...
3
by: pilar | last post by:
Hi All, How can I validate the entry in a text field depending on the first letter of the string. I need to have a text box to acept 14 characters if the first letter entered is M and 17...
0
by: Jerry | last post by:
Below is ALL the code for all the databases... Here's the problem: I callup the aspx file in IE and the form comes up just fine. When I select a person to update, I get the subject error. ...
2
by: solanki.chandrakant | last post by:
hi i have fedora linux 4 and i have simple realloc program which i am included here... plz help me to overcome the realloc to pointer to character variable. The program working 2 times but more...
1
by: Talal Itani | last post by:
I am writing code that accesses an MP3 player plugged to a USB port. The MP3 player is not showing up as a drive letter. With explorer, I see the drive, with it's name, but no drive letter is...
1
by: ArunRJ | last post by:
Hi All, I am new to the networking field. I recently had to share a folder in a Windows XP machine A with another XP machine B. The folder in machine A has some .xls files which I need to access...
3
by: kakarot vegeta | last post by:
There 's an invalid syntax error but i don't know what's wrong with it. the error says Invalid syntax: print variation_string import itertools variations = itertools.product('ab',...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.