study guide help

So, I have a final to take for C++ tomorrow and I have a few questions on the study guide that I can not figure out, if anyone can give me some answers to them so I can study this for exam that would be very appreciated.

So here are the questions:

1. Write a C++ function that reads positive integers from the user until the user enters –1 to quit. Output the largest number, the smallest number, the average, and the number of odd numbers the user inputs.

2. Write a for loop that prints numbers from 1-100, 100-1, and all even numbers from 1-100

3. Write a C++ statement to do each of the following. All are done to the same array.

a. Declare an integer array of size 36
b. Assign the fifth value in the array to be 17.
c. Assign the last value in the array to be 42.
d. Assign all values in the array to be equal to a value the user inputs.

4. Write a C++ function named processArray that takes an array of doubles as its first parameter, a double value as its second parameter, and the length of the array as the third parameter. The function should print all values in the array that are less than the second parameter.

5. Write an Else If Statement that prints out a message based on the following rules:

If the distance is The shipping cost is
At least 1 but less than 100 miles $5.00
At least 100 but less than 300 miles $8.00
At least 300 but less than 600 miles $10.00
At least 600 but less than 1000 miles $12.00

Note: Please do not write a whole entire program for each of these, please just write the function or statement needed as asked for.

Thank you very much again.
and I have a few questions on the study guide that I can not figure


Dude, this looks like all the questions?
Dude, this looks like all the questions?


No it is not at all.
Which one do you have trouble with? How much have you done on your own? If you don't even know how to start working on these and the final is tomorrow you're in trouble. :(

Which one do you have trouble with? How much have you done on your own? If you don't even know how to start working on these and the final is tomorrow you're in trouble. :(


Well, I just figured out number 2. Also, their were more questions on the study than this lol. These were just the ones I've had trouble getting to compile in practice.
I am having my most trouble with number 3 and number 4
I suggest reading http://www.cplusplus.com/doc/tutorial/arrays/ then.

Question 3 in particular seems to test your knowledge of array syntax.
Last edited on
I suggest reading http://www.cplusplus.com/forum/beginner/119685/#msg651380 then.


The link you have provided is a link to this webpage?
Topic archived. No new replies allowed.