Lab 6 Use the lab5.cpp as a started file. Modify the program is it generates 1000 points with a random x and y being values between 0 and 10000 and random c being either an 'A', 'B' or 'C'. Your program should ask for a point from the user and your program should assign a c value to that point based on the 5 closest points to it. The c value will be equal the to the most common c value of the 5 closest points.( in the case of a tie it should become an A if A and B tie, a B if B and C tie and an A is A and C tie). It should print out the 5 nearest points and the c value of the input point. Enter X and Y00 (14,9) is class A and the distant is 16.6433 (9,52) is class B and the distant is 52.7731 (17,52) is class A and the distant is 54.7083 (57,4) is class B and the distant is 57.1402 (36,46) is class B and the distant is 58.4123 (0,0) is class B
Lab 6 Use the lab5.cpp as a started file. Modify the program is it generates 1000 points with a random x and y being values between 0 and 10000 and random c being either an 'A', 'B' or 'C'. Your program should ask for a point from the user and your program should assign a c value to that point based on the 5 closest points to it. The c value will be equal the to the most common c value of the 5 closest points.( in the case of a tie it should become an A if A and B tie, a B if B and C tie and an A is A and C tie). It should print out the 5 nearest points and the c value of the input point. Enter X and Y00 (14,9) is class A and the distant is 16.6433 (9,52) is class B and the distant is 52.7731 (17,52) is class A and the distant is 54.7083 (57,4) is class B and the distant is 57.1402 (36,46) is class B and the distant is 58.4123 (0,0) is class B
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
#include <iostream>
#include <ctime>
#include <cmath>
const int MAX = 1000;
const char CLASS[] = {'A','B','C'};
struct Points{
int x,y;
char c;
double dist(Points q){
return sqrt(pow(x-q.x,2)+pow(y-q.y,2));
}
};
int main(){
return 0;
}
int main(){
srand(time(0));
}

Transcribed Image Text:Lab 6
Use the lab5.cpp as a started file. Modify the program is it
generates 1000 points with a random x and y being values
between 0 and 10000 and random c being either an 'A', 'B' or
'C'. Your program should ask for a point from the user and your
program should assign a c value to that point based on the 5
closest points to it. The c value will be equal the to the most
common c value of the 5 closest points.( in the case of a tie it
should become an A if A and B tie, a B if B and C tie and an A is
A and C tie). It should print out the 5 nearest points and the c
value of the input point.
Enter X and Y00
(14,9) is class A and the distant is 16.6433
(9,52) is class B and the distant is 52.7731
(17,52) is class A and the distant is 54.7083
(57,4) is class B and the distant is 57.1402
(36,46) is class B and the distant is 58.4123
(0,0) is class B
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education