Answered step by step
Verified Expert Solution
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++
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-, yStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started