-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.cpp
More file actions
30 lines (30 loc) · 726 Bytes
/
Copy pathprogram.cpp
File metadata and controls
30 lines (30 loc) · 726 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
#include<iostream>
using namespace std;
class Distance{
private:
int feet;
float inches;
public:
//function to take input from the user
void input(){
cout << "Enter feet in integer :" << endl;
cin >> feet;
cout << "Enter inches in float :" << endl;
cin >> inches;
}
};
int main(){
int size;
cout << " enter the size of an array :" << endl;
cin >> size;
// dynaimically allocate size of array
Distance* arr = new Distance[size];
// take three input
int count = (size > 3)? : size;
for (int i = 0; i < count; i++)
{
cout << "Eneter three size of array " << i+1 << endl;
arr[i].input();
}
delete[] arr;
}