Solved

if statement

Posted on 2000-03-14
4
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
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.
Suggested Courses

615 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