Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

if statement

Posted on 2000-03-14
4
Medium Priority
?
189 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 150 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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 how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

927 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