Question: #include #include struct point { float x; float y; }; typedef struct point POINT; POINT input_POINT(); void print_POINT(POINT); POINT calc_midPOINT(POINT,POINT); float calc_distance(POINT,POINT); float calc_slope(POINT,POINT); void
#include#include struct point { float x; float y; }; typedef struct point POINT; POINT input_POINT(); void print_POINT(POINT); POINT calc_midPOINT(POINT,POINT); float calc_distance(POINT,POINT); float calc_slope(POINT,POINT); void determine_quadrant(POINT); int main() { POINT a,b,mid; float distance,slope; printf("This program allows you to enter "); printf("two Cartesian coordinate points "); printf("and will then analyze them! "); printf("It is time to enter your first point "); a=input_POINT(); printf(" "); printf("It is time to enter your second point "); b=input_POINT(); printf(" "); printf("First point entered:"); print_POINT(a); printf(" "); determine_quadrant(a); printf(" "); printf("Second point entered:"); print_POINT(b); printf(" "); determine_quadrant(b); printf(" "); mid = calc_midPOINT(a,b); printf("Midpoint:"); print_POINT(mid); printf(" "); distance = calc_distance(a,b); printf("The distance between the points is: %8.2f ",distance); printf(" "); if(a.x == b.x) printf("The slope is undefined "); else { slope = calc_slope(a,b); printf("The slope is: %8.2f ",slope); } return 0; } void determine_quadrant(POINT p) { if(p.x==0 && p.y==0) printf("Point is on the origin "); else if (p.x > 0 && p.y >0) printf("Point is in Quadrant I "); else if (p.x < 0 && p.y >0) printf("Point is in Quadrant II "); else if (p.x<0 && p.y <0) printf("point is in quadrant iii "); else if (p.x>0 && p.y < 0) printf("Point is in Quadrant IV "); else if(p.y==0 && p.x!=0) printf("Point is on X-axis "); else printf("Point is on Y-axis "); } float calc_slope(POINT a, POINT b) { float temp; temp = (b.y - a.y)/(b.x - a.x); return temp; } float calc_distance(POINT a, POINT b) { float temp; temp = sqrt(pow(b.x - a.x,2) + pow(b.y - a.y,2)); return temp; } POINT calc_midPOINT(POINT a, POINT b) { POINT temp; temp.x = (a.x + b.x)/2; temp.y = (a.y + b.y)/2; return temp; } void print_POINT(POINT p) { printf("(%6.2f,%6.2f) ",p.x,p.y); } POINT input_POINT() { POINT temp; printf("Enter the x coordinate of your point "); scanf("%f",&temp.x); printf("Enter the y coordinate of your point "); scanf("%f",&temp.y); return temp; }
Write a complete C program.
Define a structure type element_t to represent one element from the periodictable of elements. Components should include the atomic number (aninteger); the name, chemical symbol, and class (strings); a numeric field forthe atomic weight; and a seven-element array of integers for the number ofelectrons in each shell. The following are the components of an element_t
structure for sodium.11 Sodium Na alkali_metal 22.9898 2 8 1 0 0 0 0
Have the user enter the data for one element and then display that data on the screen.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
