Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to write a C program that will read from a file, one or more sets of x,y coordinates. Each set of coordinates is

You are to write a C program that will read from a file, one or more sets of x,y coordinates. Each set of coordinates is part of a Cartesian system. A Cartesian coordinate system is a system that specifies each point uniquely in a plane by a pair of numerical coordinates. Your program will determine which quadrant each set belong. - Quadrants are often numbered 1st - 4th and denoted by Roman numerals: I(+,+), II (−,+), III (−,−), and IV (+,−).

Your program should contain a function that determines and returns which quadrant the x and y coordinate would be in.

Listed below are a few of the steps you will need to take for this program:

Use a C File Pointer (FILE*). The file you will need to open will be defined using a command line argument. You will need to open the file for reading.

You will use fscanf to read each set of coordinates. Once you have read a set of coordinates call the function you wrote to determine the quadrant it belongs in and print the appropriate output.

Below is an example input file.

-1 2

1 2

2 -1

-1 -2

Based on this input file the output would be as follows:

X and Y are in Quadrant II

X and Y are in Quadrant I

X and Y are in Quadrant IV

X and Y are in Quadrant III

Step by Step Solution

3.48 Rating (165 Votes )

There are 3 Steps involved in it

Step: 1

include void findquadrantint xint y ifx0y0 printfX and Y are i... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions