The objectives of this lab are to give you more practice at using if statements as well as functions and while loops and to begin using conditional and separate compilation for your programs. You are still expected to be thinking in terms of the algorithms for your programs before coding and to write your algorithms in the comments in your files.
You should begin by creating a new directory called Lab6 in your EE160/Labs directory (which you have created in previous labs). All of the program files you write for this lab should be in this Lab6 directory.
15
debug:15 is positive(count = 1, total = 15)
debug:15 is odd(count = 1, total = 15)
debug:Total(count = 1, total = 15)
2
debug:2 is positive(count = 2, total = 17)
debug:2 is even(count = 1, total = 2)
debug:2 is positive and even(count = 1, total = 2)
debug:Total(count = 2, total = 17)
-3
debug:-3 is negative(count = 1, total = -3)
debug:-3 is odd(count = 2, total = 12)
debug:-3 is negative and odd(count = 1, total = -3)
debug:Total(count = 3, total = 14)
-8
debug:-8 is negative(count = 2, total = -11)
debug:-8 is even(count = 2, total = -6)
debug:Total(count = 4, total = 6)
0
There were 2 positive numbers totaling 17
There were 2 negative numbers totaling -11
There were 2 even numbers totaling -6
There were 2 odd numbers totaling 12
There were 1 positive even numbers totaling 2
There were 1 negative odd numbers totaling -3
There were 4 total numbers totaling 6
cc driver1.c maxmin.c
23.5
16.1
-35.2
90
-13.1
0
cc driver2.c maxmin.c
printf("debug:Enter pos_power: base = %f exponent= %d\n", base, exponent);
printf("debug:Exit pos_power: result = %f\n", value);
cc driver3.c exponent.c
Use the "grade" command to turn in the six source files (numbers.c, maxmin.c, exponent.c, driver1.c, driver2.c, and driver3.c) and the two header files (maxmin.h and exponent.h). Your command will look like the following.
If you are in Section 001 use:
grade -lab6s1,ee160 *.c *.h
If you are in Section 002 use:
grade -lab6s2,ee160 *.c *.h
If you are in Section 003 use:
grade -lab6s3,ee160 *.c *.h
If you are in Section 004 use:
grade -lab6s4,ee160 *.c *.h
NOTE: this command will send in ALL files named with .c and .h extensions in the current directory. You should verify that you turned in things successfully, which you can do with the command (which simply leaves the file names off from the previous command).
grade -lab6s1,ee160
OR
grade -lab6s2,ee160
OR
grade -lab6s3,ee160
OR
grade -lab6s4,ee160
NOTE: after the files are prepared for grading, you will no longer be able to see your file listing using the above command. NOTE: BE CAREFUL to use the correct form of the grade command given above. If you do not, your files will be sent to the wrong place, and we will not guarantee we will find them for grading.