161/2S3, Homework Problem Set 1.

advertisement
161/2S3, Homework Problem Set 1.
Date Due: Friday, December 2nd , 2005.
Instructions for submitting your program for grading
Please note that the following also applies to all Homeworks in this course.
To submit your programs for grading, type the command
submit-work
on any of the mathematics computers and follow the instructions.
Eg: Upon typing subit-work you will be asked to enter the course and problem set number to
be submitted. For this course this will always take the form: 161:x , where x represents the
number of the problem being submitted and is always given at the top of the assignment sheet.
To compile and run your programs
The command to generate an executable called p01 from a source file p01.c is:
gcc -o p01 p01.c
Work submitted must be your own. Do not copy anybody else’s work and submit
it as yours. Do not allow anybody else to copy your work to submit as their own.
If two or more people submit identical or close copies of programs, then no marks
can be given to any of the people involved.
It is your responsibility to make sure that nobody can copy your work even without your
permission. To prevent unauthorized copying execute the following commands once:
• Make sure nobody except you can write to your own directory:
cd
chmod go-rwx .
• Make a special subdirectory of your main login directory in which to write and test your
programs.
cd
mkdir 161
chmod go-rwx 161
• Create and write all your homework programs in the directory “161” which was created
in the last item. To move into this directory the command is:
cd 161
To move back to your login directory, the command is
cd
161/2S3, Homework Problem Set 1.
Due: Friday, December 2nd , 2005.
1.0. Source: p01.c , Executable: p01
Write the example program given in the handout describing the C language. This program
reads in a real number, and calculates its square.
Call your source p01.c. Type in the program, debug it, and get it to run. Submit the source
p01.c, as already described.
Download