-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled1.cpp
More file actions
49 lines (37 loc) · 854 Bytes
/
Copy pathUntitled1.cpp
File metadata and controls
49 lines (37 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
VENKATA CHAITANYA BHAVIRISETTY
CWID 50189569
*/
/*
Course Assignment 1: All distinct points from a given list of 10 points
*/
#include <iostream>
using namespace std;
// A struct to keep items
struct point
{
int x;
int y;
}
p[10];
int main()
{
// int a[10];
cout<<"Enter the points "<<endl; //Inputting the points in the list
cout<<"x y"<<endl;
for(int i=0;i<10;i++)
{
cin>>p[i].x>>p[i].y; // accessing struct points
}
cout<<"Distinct points are" <<endl;
cout<<"x y"<<endl;
for(int i=0;i<10;i++)
{
int j; //checking previous points with present line
for(j=0;j<i;j++)
if((p[i].x==p[j].x)&&(p[i].y==p[j].y)) // checking if points are same
break; // eliminate if same
if(i==j)
cout<<p[i].x<<" "<<p[i].y<<endl; // printing distinct elements
}
}