I want run this by the group for correctness.
The question is as follows:
9. Present an example of a logic bug using pseudocode and explain your
answer. (10 points)
Temperature = 70
if (Temperature >69) and (Temperature < 100 )
THEN
openWindows;
Will work because if temperature is higher than 69 degrees and
temperature is lower than 100 degrees windows will open.
2. Gentlemen, after reading your advise I had run the code in C++,
then stated it back in pseudocode. I suppose the programmer could
mistakenly use the "AND" && operator instead of the "OR" || operator
which I found the latter to run a loop which I couldn't end, not even
with a ctrl-c, and had to push the power button in to turn off my
computer (please keep that in mind). Also found that the temperatures
reflected would better reflect opening the windows and not closing
them.
Temperature = 70
if (Temperature >69) and (Temperature < 100 )
THEN
openWindows;
Will work because if temperature is higher than 69 degrees and
temperature is lower than 100 degrees windows will open.
The code generated: numbered list 70-99
------------------------------------------------------------------------------------------------------------------------------------------------------
Temperature = 70
if (Temperature >69) or (Temperature < 100 )
THEN
openWindows;
Won't work because windows will stay closed due to temperature will
always be under 100 degrees the fault lies with the "or" "||" operator
which was used instead of the "and" (&&) operator.
The code generated: an infinite loop of never ending numbers that
crashed my computer.
Thank You,
Ray The code generated: numbered list
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Temperature = 70
if (Temperature >69) or (Temperature < 100 )
THEN
openWindows;
Won't work because windows will stay closed due to temperature will
always be under 100 degrees the fault lies with the "or" "||" operator
which was used instead of the "and" (&&) operator.
The code generated: an infinite loop of never ending numbers that
crashed my computer.
Thank You,
Ray 7 2470
popeyerayaz said:
<snip>
I suppose the programmer could
mistakenly use the "AND" && operator instead of the "OR" || operator
which I found the latter to run a loop which I couldn't end, not even
with a ctrl-c, and had to push the power button in to turn off my
computer (please keep that in mind).
Modern multi-tasking computer systems generally provide some way to
terminate a process from outside the process itself. For example, on
Windows you could have brought up the Task Manager (Ctrl-Alt-Del
nowadays), identified the process, selected it, and terminated it. Under
Linux, you could have used ps -eaf | grep <tasknameto find the task's
process ID (pid) and then used kill -9 <pidto terminate the task.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
On 22 Jul, 06:55, popeyerayaz <popeyera...@gm ail.comwrote:
your post is very confusing
I want run this by the group for correctness.
The question is as follows:
9. Present an example of a logic bug using pseudocode and explain your
answer. (10 points)
Temperature = 70
*if (Temperature >69) and (Temperature < 100 )
* * * * THEN
* * openWindows;
else
openLinux
:-)
Will work because if temperature is higher than 69 degrees and
temperature is lower than 100 degrees windows will open.
2. Gentlemen, after reading your advise [advice?] I had run the code in C++,
what gentlemen? what advice?
then stated it back in pseudocode. I suppose the programmer could
mistakenly use the "AND" && operator instead of the "OR" || operator
which I found the latter to run a loop which I couldn't end,
how the hell can the above p-code loop??!
not even
with a ctrl-c, and had to push the power button in to turn off my
computer (please keep that in mind).
I think you need a new computer.
Also found that the temperatures
reflected would better reflect opening the windows and not closing
them.
what does "temperatur e reflected" mean? The code you've posted
doesn't close windows.
Temperature = 70
*if (Temperature >69) and (Temperature < 100 )
* * * * THEN
* * openWindows;
Will work because if temperature is higher than 69 degrees and
temperature is lower than 100 degrees windows will open.
why did you post this twice?
The code generated: numbered list 70-99
what?
---------------------------------------------------------------------------*---------------------------------------------------------------------------
Temperature = 70
*if (Temperature >69) or (Temperature < 100 )
* * * * THEN
* *openWindows;
Won't work because windows will stay closed due to temperature will
always be under 100 degrees the fault lies with the "or" "||" operator
which was used instead of the "and" (&&) operator.
The code generated: *an infinite loop of never ending numbers that
crashed my computer.
there is no loop in the above code
Thank You,
Ray The code generated: numbered list
---------------------------------------------------------------------------*---------------------------------------------------------------------------*---------------------------
Temperature = 70
*if (Temperature >69) or (Temperature < 100 )
* * * * THEN
* *openWindows;
Won't work because windows will stay closed due to temperature will
always be under 100 degrees the fault lies with the "or" "||" operator
which was used instead of the "and" (&&) operator.
The code generated: *an infinite loop of never ending numbers that
crashed my computer.
Thank You,
Ray
why did you post this twice?
--
Nick Keighley
Nick Keighley <ni************ ******@hotmail. comwrites:
On 22 Jul, 06:55, popeyerayaz <popeyera...@gm ail.comwrote:
your post is very confusing
>I want run this by the group for correctness. The question is as follows:
9. Present an example of a logic bug using pseudocode and explain your answer. (10 points)
Temperature = 70 Â*if (Temperature >69) and (Temperature < 100 ) Â* Â* Â* Â* THEN Â* Â* openWindows;
else
openLinux
:-)
>Will work because if temperature is higher than 69 degrees and temperature is lower than 100 degrees windows will open. 2. Gentlemen, after reading your advise [advice?] I had run the code in C++,
what gentlemen? what advice?
>then stated it back in pseudocode. I suppose the programmer could mistakenly use the "AND" && operator instead of the "OR" || operator which I found the latter to run a loop which I couldn't end,
how the hell can the above p-code loop??!
>not even with a ctrl-c, and had to push the power button in to turn off my computer (please keep that in mind).
I think you need a new computer.
>Also found that the temperatures reflected would better reflect opening the windows and not closing them.
what does "temperatur e reflected" mean? The code you've posted
doesn't close windows.
>Temperature = 70 Â*if (Temperature >69) and (Temperature < 100 ) Â* Â* Â* Â* THEN Â* Â* openWindows; Will work because if temperature is higher than 69 degrees and temperature is lower than 100 degrees windows will open.
why did you post this twice?
>The code generated: numbered list 70-99
what?
Is the sole reason for your reply to be rude, obnoxious and generally
show off? If so, well done. 10/10.
In article <g6**********@r egistered.motza rella.org>,
Richard <rg****@gmail.c omresponded to that jerky Nick Keighley
<ni************ ******@hotmail. comthusly:
....
>Is the sole reason for your reply to be rude, obnoxious and generally show off? If so, well done. 10/10.
Of course it is. Is there (quite seriously) any other reason to post to
clc?
(And you should have seen the smile on his face when he did it...)
On Jul 22, 10:55*am, popeyerayaz <popeyera...@gm ail.comwrote:
<snip>
You aren't making much sense. Please re-phrase your question in a way
that everyone can understand it. And try posting to the point.
On 22 Jul, 11:55, Richard<rgr...@ gmail.comwrote:
Nick Keighley <nick_keighley_ nos...@hotmail. comwrites:
On 22 Jul, 06:55, popeyerayaz <popeyera...@gm ail.comwrote:
your post is very confusing
I want run this by the group for correctness.
The question is as follows:
9. Present an example of a logic bug using pseudocode and explain your
answer. (10 points)
Temperature = 70
*if (Temperature >69) and (Temperature < 100 )
* * * * THEN
* * openWindows;
else
* * openLinux
:-)
Will work because if temperature is higher than 69 degrees and
temperature is lower than 100 degrees windows will open.
2. Gentlemen, after reading your advise [advice?] I had run the code in C++,
what gentlemen? what advice?
then stated it back in pseudocode. I suppose the programmer could
mistakenly use the "AND" && operator instead of the "OR" || operator
which I found the latter to run a loop which I couldn't end,
how the hell can the above p-code loop??!
not even
with a ctrl-c, and had to push the power button in to turn off my
computer (please keep that in mind).
I think you need a new computer.
Also found that the temperatures
reflected would better reflect opening the windows and not closing
them.
what does "temperatur e reflected" mean? The code you've posted
doesn't close windows.
Temperature = 70
*if (Temperature >69) and (Temperature < 100 )
* * * * THEN
* * openWindows;
Will work because if temperature is higher than 69 degrees and
temperature is lower than 100 degrees windows will open.
why did you post this twice?
The code generated: numbered list 70-99
what?
Is the sole reason for your reply to be rude, obnoxious and generally
show off? If so, well done. 10/10.- Hide quoted text -
oh course. :-)
if he wants help (I assume that's why he posted to comp.lang.c)
then he's going to have to ask a clear question. His post seemed
to be part of a longer converstation or had been extracted from
another post. I found it unclear. Perhaps if he asked a clear
question he'd get better help. Improving his ability to ask
questions might even make him a better programmer.
What was your reason for posting?
--
Nick Keighley
When it comes to feeding trolls, taking offense at their posts is
like serving them Lobster Thermidor aux Crevettes with Mornay sauce
served in a Provencale manner with shallots and aubergines garnished
with truffle pate, brandy and with a fried egg on top and Spam.
On Jul 22, 2:57 pm, Nick Keighley <nick_keighley_ nos...@hotmail. com>
wrote:
<snip reply to troll>
What was your reason for posting?
Trolling.
When it comes to feeding trolls, taking offense at their posts is
like serving them Lobster Thermidor aux Crevettes with Mornay sauce
served in a Provencale manner with shallots and aubergines garnished
with truffle pate, brandy and with a fried egg on top and Spam.
s/taking offense/replying This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff Melvaine |
last post by:
I note that I can write expressions like "1 << 100" and the result is stored
as a long integer, which means it is stored as an integer of arbitrary
length. I may need to use a large number of these, and am interested to
know whether the storage efficiency of long integers is in danger of
breaking my code if I use too many. Would I do better to write a class that
defines bitwise operations on arrays of integers, each integer being assumed...
|
by: Mad Scientist Jr |
last post by:
Has anyone worked on code that that can parse evaluation expressions
(could be numbers or strings) like
( ( "dog" = "dog" ) or "foo" = "bar" ) and ("cow" = "bat" and "bye" =
"hi") or ("math" = "fun")
or
( ( 1 = 5 ) or ( 2 < 3 ) ) and (1 <= 6)
|
by: Lobbo1 |
last post by:
Hi,
Im a computing student and need help with some pseudocode. The
following is what I have got so far...
SET point_value = 10
SET suit_value = Hearts
SET point_valueA = suit_valueA = guess_count = game_count = = 0
REPEAT
OUTPUT message to operator for suit_valueA
GET suit_valueA
|
by: Bob Sparks |
last post by:
Can some one post an example, or where to find one, using DBINFO in a
SQL procedure? I can't seem to find one anywhere. I don't see the
linkage between the structure and the SQL language variables in the
documentation.
A SCRATCHPAD example would be useful too.
I need to identify which user is executing a stored procedure, then
pick up the same information in a trigger. The application runs on
several platforms so I don't want to code...
|
by: david |
last post by:
1.I am considering doing a midi file generator for my
4th year project in B.SC.
2.I would do it using c language, but i'm not sure abou t the
level of difficulyt involved
3.Basically, the executable c program would read a text document
with some "musical pseudocode" representing some `tune`.
Then convert the "musical pseudocode" into "midi code" that
could be played in any midi player like `windows media player`.
4.How would you do this?...
| |
by: Justine |
last post by:
Hi All,
I would like to know where & when exactly we would have a
need for attributes. A realistic example.
Thanz in Advance,
Justine
|
by: HK |
last post by:
With VB.NET 2005, and a Windows Form, running on a dual CPU box, I need to
take a recordset (e.g. 100,000 records) and spawn a thread to handle an
internet XML transaction routine for each of the records. This is a nice
use of threading because those internet requests are going against 3rd party
servers that often have 1 second latency problems and so handling them with
multiple threads is the fastest way to get through all the records in...
|
by: NeoPa |
last post by:
CHAPTER 1 - TABLE OF CONTENTS (Including attached database)
CHAPTER 2 - INTRODUCTION
CHAPTER 3 - TABLE LAYOUT
CHAPTER 4 - FORM LAYOUT
CHAPTER 5 - FORM MODULE
CHAPTER 6 - CODE DISCUSSION (FILTER CONTROLS)
CHAPTER 7 - CODE DISCUSSION (THE REST)
--------------------------------------------------------------------------------
|
by: Joah Senegal |
last post by:
Hello all,
I;m a beginner C++ and I;m trying to convert some pseudocode into C++. Its
pseudo code of the peterson algorithm for N-processes.
I almost converted the whole code. But the last lines are very hard.
This is the pseudo code:
for
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |