logoISU  

CS256 - Principles of Structured Design

Fall 2021

Displaying ./code/cs256su21code/jun09/circle.c

/*

we've combined our area and circumference programs into one program
we also made functions for finding the area and circumference of the circle


*/


#include <stdio.h>
#include "circle.h"

/*

    we made our own header file (circle.h) that stores the definitions for the
    functions areaCircle and circumCircle

    when including header files you've created, you use double quotes around the name as seen above
    header files included in the system are surround with <this> symbol.

    then you can just compile this file by typing  gcc circle.c

    make sure that the circle.h file is included in the same directory as this .c  source file

*/

int main(){

	double radius; //because now we want radius to handle decimals

	printf("Enter the radius: ");
    scanf("%lf", &radius); //since radius is a double , we need the %lf signifier for scanf 
                           // to be able to read doubles  

    double area, circumference;

    area = areaCircle(radius);
    //both these functions are defined in circle.h
    circumference = circumCircle(radius);

    printf("Radius of Circle: %f\n", radius);
    printf("Area: %f, Circumference: %f\n", area, circumference);

    return 0;

}