cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
confused
confused
May 12, 2015 at 11:23am UTC
kunz
(25)
how can i write this code
if "a" , "b" and "c"
have the same value then print same value
May 12, 2015 at 11:54am UTC
Tom56785
(82)
Something like this:
1
2
3
if
(a == b && a == c) { std::cout <<
"They are all the same!"
<< std::endl; }
If '
a
' equals '
b
', and '
a
' equals '
c
' then '
b
' and '
c
' must be the same so you don't need to check those values.
May 13, 2015 at 9:30pm UTC
kunz
(25)
so
b will also be equal to c ??
May 13, 2015 at 9:34pm UTC
AbstractionAnon
(6954)
Yes. It's call transitivity.
http://en.wikipedia.org/wiki/Transitive_relation
May 13, 2015 at 9:47pm UTC
kunz
(25)
thanks mate :)
Topic archived. No new replies allowed.