473,325 Members | 2,870 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,325 software developers and data experts.

a < b ? b : a

I seem to have figured out that:

a < b ? b : a

returns a when a < b = false and b when a < b = true

but what is the statment:

Exp ? Exp : Exp

called? Could not find anything describing it in my book Accelerated C++
Apr 23 '07 #1
5 1386
desktop wrote:
I seem to have figured out that:

a < b ? b : a

returns a when a < b = false and b when a < b = true

but what is the statment:

Exp ? Exp : Exp

called? Could not find anything describing it in my book Accelerated
C++
The official name of that _operator_ is "conditional". As in
"the conditional operator". It's the only *ternary* operator
in C++ (one that has three operands). It's not overloadable.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Apr 23 '07 #2
On 23 Apr, 14:24, desktop <f...@sss.comwrote:
I seem to have figured out that:

a < b ? b : a

returns a when a < b = false and b when a < b = true

but what is the statment:

Exp ? Exp : Exp

called? Could not find anything describing it in my book Accelerated C++
The operator is called the Conditional Operator and an expression
using it like your example is a Conditional Expression.

Gavin Deane

Apr 23 '07 #3
desktop :
I seem to have figured out that:

a < b ? b : a

returns a when a < b = false and b when a < b = true

but what is the statment:

Exp ? Exp : Exp

called? Could not find anything describing it in my book Accelerated C++
cond ? expr1 : expr2;
I think they are the same.

--
Thank you very much! :)
Thank this newsgroup very much! :)
Visual Studio 2005 Professional Edition
Windows XP Professional
Apr 23 '07 #4
"desktop" <ff*@sss.comwrote in message
news:f0**********@news.net.uni-c.dk...
but what is the statment:
Exp ? Exp : Exp
called? Could not find anything describing it in my book Accelerated C++
It's on page 45, where it's described as the "conditional operator"

Page 45, in turn, is mentioned in the index under the "?:" heading.
Apr 23 '07 #5
It's called the conditional operator, though it's also commonly known
as the ternary operator, since it's the only one in C++.

Ranok

Apr 23 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
4
by: matatu | last post by:
Hi to all, I have a xml file, a substring like: &lt;a href=&quot;#&quot;&gt;text&lt;/a&gt; which after an xslt trasform is rendered as (using xsl:output method html): &lt;a...
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash...
6
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.