Refer to course grading and academic policy for due date.


Introduction

In CS 125, CS 225, and other classes, you have used various languages that are considered to be "C based", but up to now you may have very limited experience in C programming. This MP will provide a short programming introduction to pointers, strings, and functions in C.

This machine problem will be divided up into two pieces. In the first piece, you will be modifying functions originally with errors such that the outputs match the given output. In the second piece, you will need to write some code to call some 'creatively defined' functions so that those functions produce the desired output. Make sure you free'd all allocated memories!

For this MP, you may modify:

All other files will be replaced with new/different files for grading. If you modify any other files for debugging purposes, please ensure you test your program with the original file.

PLEASE MAKE SURE YOUR COMMITTED FILES CAN BE COMPILED! OTHERWISE YOU WILL RECEIVE A ZERO!

What you must do...

...for Part 1:

There are erroneous/unimplemented functions in part1-functions.c. Your challenge is to modify functions according to comment above each function such that the output of part1 looks exactly as follows:

== one() ==
3^2 + 4^2 = 25
10^2 + 10^2 = 200
== two() ==
20 not passed!
100 passed!
== three() ==
The value of p is: 4
== four() ==
The value is between zero and one.
The value is not between zero and one.
== five() ==
x and y are equal.
x and y are different.
== six() ==
4 == 4.000000
432 == 432.000000
== seven() ==
a is a letter.
a is not a letter.
== eight() ==
Hello
== nine() ==
The value of p is: 12.500000
== ten() ==
0 == 0?
== eleven() ==
Hello World!
== twelve() ==
0.000000 0.100000 0.200000 0.300000 0.400000 0.500000 0.600000 0.700000 0.800000 0.900000
== thirteen() ==
0 10 40 90 160 250 360 490 640 810
== fourteen() ==
orange and blue!
ORANGE and blue!
Orange and BLUE!
orange and blue!
== fifteen() ==
You passed in the value of one!
You passed in the value of two!
You passed in some other value!
== sixteen() ==
Hello
== seventeen() ==
The radius of the circle is: 17.500000.
The radius of the circle is: 10.000000.
== eighteen() ==
Result: 323
Result: 2499
== clear_bits() ==
170
0
171
0
20
0

...for Part 2:

We have pre-uploaded some files to your mp0 svn directory, including part2-functions.c. Inside part2-functions.c, you will see ten different functions, including first_step() (re-printed below).

void first_step(int value)
{
  if (value == 81)
    printf("1: Illinois\n");
}

To complete Part 2, you must complete the program part2-main.c so that part2-main.c makes calls to all eleven functions in part2-functions.c such that they print their "Illinois" line. When running ./part2, your output should look exactly like:

1: Illinois
2: Illinois
3: Illinois
4: Illinois
5: Illinois
6: Illinois
7: Illinois
8: Illinois
9: Illinois
10: Illinois
11: Illinois

You should NOT edit the part2-functions.c file. In fact, when we grade your program, we will replace the part2-functions.c file with a new version of the file (and we'll change the "Illinois" string so printing out "Illinois" in a for-loop will get you no credit).

Compile and Run

To compile MP0, run:
make clean
make
To run Part 1:
./part1
To run Part 2:
./part2

Grading, Submission, and Other Details

Please fully read details on Grading and Academic Honesty. These are shared between all MPs in CS 241.

We will be using Subversion as our hand-in system this semester. Our grading system will checkout your most recent (pre-deadline) commit for grading. Therefore, to hand in your code, all you have to do is commit it to your Subversion repository. There is also a useful page for SVN Commands.

To check out the provided code for mp0 from the class repository, go to the directory you want your work to be downloaded to and type the following into the command console:

svn co https://subversion.ews.illinois.edu/svn/fa14-cs241/NETID/mp0 mp0 ;
where NETID is your University NetID. This will make a directory called mp0 which has all mp0 code in it.

To commit your changes to the repository type:

svn ci -m "mp0 submission"

Your repository directory can be viewed from a web browser from the following URL:

https://subversion.ews.illinois.edu/svn/fa14-cs241/NETID/mp0 , where NETID is your University NetID.
It is important to check that the files you expect to be graded are present and up to date in your svn copy.

Good luck!