Solved

if statement

Posted on 2000-03-14
4
182 Views
Last Modified: 2010-04-15
Hi,

I tried this code but it is not working. How can I implement a double condition (for if)?

if (reynolds < 2.0e5 ) & (reynolds > 100.0 )
  {
     const_n = 0.6;
     const_c = 0.402;
  }
  else
  {
     const_n = 0.84;
     const_c = 0.022;
  }

Thank you

Hooky
0
Comment
Question by:hooky
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
KangaRoo earned 50 total points
ID: 2615615
if (reynolds < 2.0e5  && reynolds > 100.0 )
  {
     const_n = 0.6;
     const_c = 0.402;
  }
  else
  {
     const_n = 0.84;
     const_c = 0.022;
  }

0
 

Expert Comment

by:myokomiz
ID: 2615624
Hi Hooky,
Have you tried to split your double condition into two single conditions ?
Just for debbuging ...
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 2615625
You rcode was essentially:

  if (expr1) & (expr2) statement;

Which the compiler sees as
  if expr1 is true take_addres(expr2) statement ---> error!!

Secondly, I suspect you wanted a logical and and not a bitwise. The operator for logical and is &&
0
 

Author Comment

by:hooky
ID: 2615737
Thank you
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question