0 like 0 dislike
1k views
  1. Create a project.
  2. Divide the program (progtest.c) into several files. You do it according to each function. For example, progmain.c, area.c, peri.c, and show.c. progmain.c is the main program. It will call area() function in (area.c) and peri() function in (peri.c).
  3. Write a header file to define macro definitions and prototypes of functions.
  4. Execute the main program.
  5. Compress the whole project into a file and upload it.
/* progtest.c, an example of a large program */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>   		/*  math.h  */
#define PI 3.1416
double area(double r);
double peri(double r);
void show(double r);
int main(void)      		/* main() */
{
   printf("area(2.2)=%5.2f\n",area(2));
   printf("peri(1.4)=%5.2f\n",peri(3));
   system("pause");
   return 0;
}

double area(double r)	/* area(),compute the area of a circle */
{
   show(r);
   return (PI*pow(r,2.0)); /* pow(r,2.0), compute square of r */
}

double peri(double r)     /* peri(),compute periphery */
{
   show(r);    
   return (2*PI*r);   
}

void show(double r)     	/* show(),shwo radius */
{
   printf("Radius is %5.2f, ",r); 
}

To upload a file:

 

[Exam] asked in Midterm
ID: 23788 - Available when: Unlimited - Due to: Unlimited

reshown by | 1k views

20 Answers

0 like 0 dislike
Hidden content!
***** *** ** ** ** * ******* ** * ** * *

???
answered by (38 points)
0 like 0 dislike
Hidden content!
* ** * * * * ** * *** ** ** * ***** ******
answered by (20 points)
0 like 0 dislike
Hidden content!
*** ** ** * *** ** ** ********** ** ***
answered by (-34 points)
0 like 0 dislike
Hidden content!
* * **** *** * **** * ** * * ** * *
answered by (-34 points)
0 like 0 dislike
Hidden content!
* * ** * *** *** *** * * * *** * * ** *
answered by (-581 points)
0 like 0 dislike
Hidden content!
* *** * * * * *** ****** **** ***
answered by (24 points)
0 like 0 dislike
Hidden content!
* * * ****** *** * ** **** * * ** *** *
answered by (6 points)
0 like 0 dislike
Hidden content!
* *** ** * * ** * * ** ** *** * * * * *
answered by (-364 points)
0 like 0 dislike
Hidden content!
* * *** * ****** * ****** * ** ** *** * *
answered by (-189 points)
0 like 0 dislike
Hidden content!
Not sure *** the * * **** but the * ** ** *
** * ***** *** * ***** * * ** ** ** **
answered by (-48 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.174
©2016-2024

Related questions

0 like 0 dislike
4 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24272 - Available when: Unlimited - Due to: Unlimited
| 373 views
0 like 0 dislike
8 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24273 - Available when: Unlimited - Due to: Unlimited
| 520 views
0 like 0 dislike
6 answers
[Normal] asked Apr 21, 2017 in Midterm by thopd (12.1k points)
ID: 24271 - Available when: Unlimited - Due to: Unlimited
| 453 views
0 like 0 dislike
11 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24270 - Available when: Unlimited - Due to: Unlimited
| 659 views
0 like 0 dislike
13 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24269 - Available when: Unlimited - Due to: Unlimited
| 798 views
12,783 questions
183,443 answers
172,219 comments
4,824 users