01-11-2009, 12:01 AM
|
#193
|
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
|
رد: [cpcs 202 - برمجة 1] لديك سؤال , واجبات , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد
Build a library called math_shapes.h that contains of the 2 functions described in Program 4:
1. circle_area() 2. circle_area()
and re-write the Program 4 by including the new library and removing the 2 functions from the code? (Show the code of the two files and the output in ONE page only
|
الحل :
ملف الهيدر :

كود:
#include <stdio.h>
double circle_area (double radius) {
return 3.14 * radius * radius;
}
double circle_cirum (double radius) {
return 2 * 3.14 * radius;
}
وظيفة main :

كود:
/*
Build a library called math_shapes.h that contains
of the 2 functions described in Program 4:
1. circle_area() 2. circle_area()
and re-write the Program 4 by including t
he new library and removing the 2 functions
from the code? (Show the code of the two files and
the output in ONE page only
*/ #include <stdio.h>
#include "math_shapes.h"
int main(void) {
float d;
printf("Please Enter the radius : ");
scanf("%f",&d);
printf("\nThe area of circle = %.3f\n",circle_area(d));
printf("\nThe cirum of circle = %.3f\n",circle_cirum(d));
return 0;
}
النتيجة :
|
|
سبحان الله وبحمد ,,, سبحان الله العظيم الحمد لله كما ينبغي لجلال وجهه وعظيم سلطانه . اللهم صل على محمد وعلى آل محمد كما صليت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد . اللهم بارك على محمد وعلى آل محمد كما باركت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد.
|
|
|
|