UMBC CMSC 104 Spring 2000 CSEE | 104 | current 104

Project 1

Circles

Out: 3/30/00
Due: Before midnight, Wed 4/5/00


Write a program called circle.c that gets the radius of a circle from the user and prints the diameter, area and circumference of that circle. Use a #define preprocessor directive to define the constant PI as 3.14159. You should use floating point variables. Don't forget to have an explanation of the program that is displayed to the user before he's prompted for input. This is typically known as a greeting and all programs should have a greeting.

Be sure to have a program header comment that contains the filename, your name, the date written, and a description of the program. Adhere to the coding standards and use one of the indentation styles shown on the indentation styles sheet, available from the projects web-page. Use meaningful variable names and comments within your code. As we did in class, logical sections of your code should be separated from one another by white space (a blank line) and each section should have a comment above it. Arithmetic operators should have a space both before and after them.

For example, use :

surfaceArea = 2 * (length * width + length * height + width * height);

not :

surfaceArea=2*(length*width+length*height+width*height); because it is much easier to read.

Submit your project by sending your source code (circle.c) to me (bogar@cs) from your gl account using pine with your source file as a pine attachment. Do NOT send your executable file (a.out)



Thursday, 30-Mar-2000 08:43:11 EST