Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Please use this template //Add headers using namespace std; struct Coordinates{ int x; int y; }; Coordinates furthestPoint(/*parameters*/) { //Complete function } int main(){

C++

image text in transcribedimage text in transcribed

Please use this template

//Add headers

using namespace std;

struct Coordinates{ int x; int y; };

Coordinates furthestPoint(/*parameters*/) { //Complete function }

int main(){ string filename; /ame of input file char option; //option character //Add other necessary variables //Read input //File I/O operations, creating and filling dynamic array switch(option) { //list and complete cases } return 0; }

In this program you will be required to read cartesian coordinates from an input file and store them in a dynamic array of structures of type struct Coordinates int x; in y: li The coordinates in the file will be written in the following format: 1, 2 3, 4 -5,-6 You must use a dynamic array of the correct size (equal to the number of points in the file) for full credit. You will use standard input to read the name of the file and a lowercase letter indicating the type of operation you need to perform on the points. A sample input would be input_file.txt a If the file does not exist, you must print to standard output the following error message: Error file not found. If the file does exists, but it is empty, you must print to standard output the following error message: Error: empty file. If the file exists and it is not empty. you can assume that it will include coordinates in the right format After reading the input file and storing the points in the array, you will have to perform one of the following operations: Print all points (option 'a): send all points to standard output, in the order they were read from the input file. You must use the following format: 1:2] 13:4 L-5;-6] Print all points in a quadrant (option 'b, 'c, 'd' and 'e): send to standard output only the points that belong to a specific quadrant (use the same format as option 'a, ky). Print quadrant 1 if option 'b' (x- y>-0), quadrant 2 if option 'c' (x-, y

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

=+ Is the information source respected?

Answered: 1 week ago

Question

5. Do you have any foreign language proficiency?

Answered: 1 week ago