Need help please, thank you. The following structures are designed to store info
ID: 3776065 • Letter: N
Question
Need help please, thank you. The following structures are designed to store information about objects on a graphics screen. A point structure stores the x and y coordinates of a point on the screen. A rectangle structure stores the coordinates of the upper left and lower right corners of a rectangle. struct point {int x, int y;); struct rectangle {struct point upper left, lower right;}; Write functions that perform the following operations on a rectangle structure r passed as an argument: Compute the center of r, returning it as point value. Function name: Center Move r by x units in the x direction and y units in the y direction, returning the modified version of r. (x and y are additional arguments to the function.) Function name: Move Determine whether a point p lies within r, return TRUE or FALSE, (p is an additional argument of type struct point). Function name: IsInRectangle Suppose following declaration is in effect. struct rectangle *p; Assume that we want p point to a rectangle structure whose upper left corner is at (2, 3) and whose lower right corner is (0, 1). Write a series of statement that allocates such a structure and initialize it as indicated. Now modify rectangle structure by adding one more member in it as following: struct rectangle {struct point upper left, lower right; char *name;Explanation / Answer
#include<stdio.h>
#include<conio.h>
int main() {
int length, breadth, area;
printf(" Enter the Length of Rectangle : ");
scanf("%d", &length);
printf(" Enter the Breadth of Rectangle : ");
scanf("%d", &breadth);
area = length * breadth;
printf(" Area of Rectangle : %d", area);
return (0);
}
2. That doesn't affect.
#include<stdio.h>
#include<conio.h>
int main() {
int length, breadth, area;
printf(" Enter the Length of Rectangle : ");
scanf("%d", &length);
printf(" Enter the Breadth of Rectangle : ");
scanf("%d", &breadth);
area = length * breadth;
printf(" Area of Rectangle : %d", area);
return (0);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.