Question
For this program you will be printing of a grid of 10 points (x, y). You will be reading the points from a file, and
For this program you will be printing of a grid of 10 points (x, y).
You will be reading the points from a file, and printing the points and grid to a file.
Program template link - https://pastebin.com/1ES4b5mH
Both files will be specified in the command-line arguments.
** Your output in the file must match mine EXACTLY. **
The grid will be 20x20, which means all points will fall within the range 0 <= x <= 19.
You will also be tasked to find the 2 points that are closest to each other. These 2 points will be marked by a different character in your grid.
You should use the following functions:
fill() getdist() closest() grid() printpoints() printgridxy()
You will read the points from the file into an array of structures. One structure should contain an x-value and a y-value.
Follow all instructions in the program.
Example input file: (will contain exactly 10 points) 7 19 11 5 15 11 4 10 1 8 10 4 2 5 14 12 10 9 12 4
Example running: ---------------------------------------------------------------------- $ ./a.out points.txt output.txt
Example output file: 0: ( 7, 19) 1: (11, 5) 2: (15, 11) 3: ( 4, 10) 4: ( 1, 8) 5: (10, 4) 6: ( 2, 5) 7: (14, 12) 8: (10, 9) 9: (12, 4) -------------------------------------------------- * * * * * * * X X * --------------------------------------------------
================================================================== for readability purposes only! -------------------------------------------------- 19: * 18: 17: 16: 15: 14: 13: 12: * 11: * 10: * 9: * 8: * 7: 6: 5: * X 4: X * 3: 2: 1: 0: -------------------------------------------------- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Step 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