CSE102-Assignment 1 Control Statements, Arithmetic Operations Input/Output Solved
• You will write a C program according to the following description.
• Your program catches user input, learns and tests a simple classifier. This is about using control statements, performing arithmetic operations and simple input/output.
Program Flow • Read pre-defined number of points for class 1.
• Read pre-defined number of points for class 2.
• Find the average point for each class.
• Find the line connecting the two average points.
• Find the midpoint of the connecting line.
• Find the perpendicular separating line which passes through the midpoint.
• Classify any given point and print its label until an unusual input is encountered.
Figure 1: Visualization
Example
# commands comments
line 0 10.4 34.8 User enters point coordinates for class 1
line 1 3.5 45.9
. . .
line 10 22.2 12.6 User enters point coordinates for class 2