CISC 105 Lab 03 FAQ

For each of the following questions, I'll give suggestions for "troubleshooting" the problem.

Notes from Sara:

Do you want us to put comments at the top of the program describing what the program does?

For this assignment, I expect that you will describe the program at a high level at the top of your program. The description does not need to be long. Just write what you're doing in your own words.

For part 8, I am having a hard time understanding the values I get when I evaluate x = 1 < 5 > 0, and x = 1 < 5 < 2.

The computer evaluates these expressions from left to right. For example, if the computer evaluates 4+3+1, it adds 4+3 (to get 7) and then adds 1 to get 8. Can you see how that applies to this problem?

The conditions aren't "supposed" to make sense. They are examples of bad code. You should understand that they do compile and why they get their result. Then, you should find another way to express the condition correctly.

As more practice, think about the condition if ( 1 < 2 > 1 ).

For lab03.10.c, are we allowed to use && or ||?

Nope!

Do you have any hints on how to get the numbers to display in order with only two comparions?

How much information can you get from just one comparison? You won't know the correct answer, but you can figure out what is *not* the answer, right?

I am having a difficult time trying to figure out the answer to part 10 of Lab3. I can't get the program to work with less than 3 numerical comparisons.

It's okay if the program contains three numerical comparisons, but the program can only execute two comparisons when the user inputs a number.

Problem 10: help finding the minimum

Try thinking about it this way: create a new variable that will contain the "current" minimum. Go through the three integers and "search" for the minimum. If there is only one integer (you've only looked at/read in one integer), what would the minimum be? If there are two integers, what would the minimum be? etc...

Is "=" a comparison operator?

No, "=" is the assignment operator. "==" is the comparison operator.

Do you take off for mistakes in the script but then are corrected later down in the script?

No, but please indicate which part is wrong and highlight the correct part so that it's easy for me to figure out what happened.