خلاص مشكورين جت معي .
بالنسبة للحوسبة انا عند با جابر وقلنا الاختبار بكرة بس شابتر 5 و 7 واختبار الاثنين 5 و 7 و 8
__
معليش اذا في امكانية هذا سؤال جاء لسكشن اخر وفي اختلاف بسط ياليت لو احد يحله .. والله يوفقكم .
Write a C program that calculates and displays the distance DIST (type double) between two points A and B of the plane which the coordinates (XA, YA) and (XB, YB) are entered by keyboard as an integer by using:
• A header functions to calculate DIST.
• A header functions to calculate the Area of the triangle (AREA)
DIST = square root ((XA-XB)2 + (YA-YB)2)
AREA=(Width *high)/2
|
تفضل هذا الحل ..
كود:
#include<stdio.h>
#include<math.h>
double dist (double xa ,double xb , double ya , double yb )
{
double dist;
dist = sqrt ((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
return dist;
}
double area(double width ,double high)
{
return((width *high)/2);
}
int main ()
{
double xa,xb,ya,yb;
double width,high;
printf(" enter XA= ");
scanf("%lf",&xa);
printf(" enter XB= ");
scanf("%lf",&xb);
printf(" enter YA= ");
scanf("%lf",&ya);
printf(" enter YB= ");
scanf("%lf",&yb);
printf("dist = %1f\n\n",dist (xa,xb,ya,yb));
printf(" enter WIDTH= ");
scanf("%lf" ,&width);
printf(" enter HIGH= " );
scanf("%lf",&high);
printf("area= %1f\n\n",area (width,high));
return(0);
}
دُمت بخير