Solved

if statement

Posted on 2000-03-14
4
180 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops 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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now