Starting from:

$30

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

line 11 62.1 11.0

.

. .

line 20 10.2 34.9                                                      User enters a test point

line 21 class 1                                                           Program prints its class

line 22 10.3 33.8                                                      User enters a test point

line 23 class 1                                                           Program prints its class

. . .

line x q                                                                      User enters something not expected

Program quits.

More products