Complete and utter noob question. I just started taking an introductory programming class this semester, and I'm already stuck on this assignment:
My teacher's lectures really aren't any help. I'm just not sure how to get the program to save the answers you enter, and then compare them to each numbers before it.
Code:
Write a C program which prompts the user to enter some numbers and prints Non-decreasing if no number is smaller than the previous number, and No otherwise.
Entering 0 should terminate the sequence of numbers and cause the result to be displayed.
The user can enter numbers with or without a fractional part.
The program should work as described above for numbers that are positive, negative or zero.
The prompts and output displayed by the program must be formated as shown in the sample run below (e.g. blank lines, spacing, case of text).
A sample run of your program should look like:
Entering 0 will terminate the sequence of input values.
Enter a number: -7.6
Enter a number: -2
Enter a number: 5
Enter a number: 5
Enter a number: 0
RESULT: Non-decreasing
My teacher's lectures really aren't any help. I'm just not sure how to get the program to save the answers you enter, and then compare them to each numbers before it.