CMPS 1044 – Program 2 – Spring 2016

advertisement
CMPS 1044 – Program 2 – Spring 2016
Relational Operators (IF, WHILE)
Problem Solving Steps: DUE Monday, February 29
Program Due: Monday, March 7
Operators that check the relationship between two values are called Relational Operators.
Given 2 integer values, Val1 and Val2, your program is to determine the relationship between
them; either less than, greater than, or equal to. You must use the if/then/else construct
and a while loop in your program.
INPUT
The first line of the input file is an integer, Total, indicating the number of pairs of integers to
be processed. Use Total as the limit on the while loop. Use your own data to begin
development and debugging.
OUTPUT
For each line of input, produce one line of output containing the relational operator indicating
the relationship of the 2 integers. (< , > , = ) Following the operator print the 2 integers. The
integers must be in right aligned columns.
Sample input
3
10 100
500 20
4000 4000
Sample Output
<
10
100
>
500
20
=
4000 4000
DATA
TWO data files will be posted on the class web site. Execute your program for each data set
posted. Turn in
 Printout of your well-documented code
 Printout of Results from data file 1
 Printout of Results from data file 2
 (No need to turn in copies of input files)
NOTE: When variable names are supplied in the problem description, you are REQUIRED to use
those names.
Download