473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

true/false statements

Can you help me to write a method to return true if a number or rational class is positive and return false if it is negative. I hope that is simplified enough. I'm not sure how else i can put it.
Jan 20 '07 #1
5 2539
Ganon11
3,652 Expert 2GB
You have to check if the number is greater than 0, so your if statement will be

Expand|Select|Wrap|Line Numbers
  1. if (num > 0)
In your first block, return true; in your second block, return false.
Jan 20 '07 #2
horace1
1,510 Expert 1GB
Can you help me to write a method to return true if a number or rational class is positive and return false if it is negative. I hope that is simplified enough. I'm not sure how else i can put it.
you can return true or false with a statement such as
Expand|Select|Wrap|Line Numbers
  1.     return x >= 0;
  2.  
will return true (non zero) if x >= 0 else false (0) if x < 0
Jan 20 '07 #3
hi, thanks but I need to know how to write a true false statemen using names. First and last name. thank you for all your help, i really needed it and appreiciate it.
Jan 24 '07 #4
Motoma
3,237 Expert 2GB
hi, thanks but I need to know how to write a true false statemen using names. First and last name. thank you for all your help, i really needed it and appreiciate it.
Perhaps you could elaborate; if you provided sample input and desired output, we would be able to help better.
Also any code you have already tried would help us understand the problem better.
Jan 24 '07 #5
DeMan
1,806 1GB
Whatr is a rational class?
Jan 24 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: dave | last post by:
I recently started using python and am trying to create the following four statements as Lambda Functions. mode == 1 ? TRUE : FALSE mode == 2 ? TRUE : FALSE mode == 3 ? TRUE : FALSE mode == 4...
46
by: Scott Chapman | last post by:
There seems to be an inconsistency here: Python 2.3.2 (#1, Oct 3 2003, 19:04:58) on linux2 >>> 1 == True True >>> 3 == True False >>> if 1: print "true" ....
14
by: root | last post by:
Hi group, Apologies in advance if this has been asked somewhere before, but I haven't managed to get anything from the Google archives - I've been getting introductory guides to C++ all day...
11
by: Arpan | last post by:
<% If(False) Then Response.Write("False") Else Response.Write("True") End If %> In the above code, the Else condition will be executed. Why?
22
by: Paminu | last post by:
As I remember if(1) evaluates to true and all other numbers including 0 evaluate to false. But where do I find out about this for sure?? I have looked through K&R, all the C for dummies books...
30
by: Jason | last post by:
I am fairly new to ASP--I have been using it about 2 months. I did these tests (below), and it doesn't make sense to me. False is equal to 0, and that's fine. True should be equal to 1, but it's...
3
by: André | last post by:
Hi, I put that question already, but it's still not very clear to me, so ... Assume following option in web.config= debug="false" but in one aspx page (test.aspx) <%@ debug="true" ..%>
90
by: John Salerno | last post by:
I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? False print 'hi' hi Thanks.
5
by: maestro | last post by:
why does this work? "while p" = "while p != 0" ? 1 is True and 0 is false in python but other numbers have no boolean value so why doesnt it abort. 16 print p p -= 1
32
by: Simon L | last post by:
BOOL bMyarray; memset(bMyArray , 0xFF, sizeof(BOOL) * 1000); clean & quick until someone else's code found I was returning -1 to mean true Because my BOOL is 4 bytes long, TRUE in memory...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.