-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (51 loc) · 1.02 KB
/
Copy pathmain.cpp
File metadata and controls
54 lines (51 loc) · 1.02 KB
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
48
49
50
51
52
53
54
#include <iostream>
#include "dft.cpp"
#define PI 3.14159265
/*Concepts Used are:
Classes
Objects
Inheritance
Polymorphism
Abstraction
Encapsulation
Friend Class
Constructor
Destructor*/
int main(){
int choice,n;
float x[100],y[100];
cout<<"Enter 0 for DFT"<<endl;
cout<<"Enter 1 for IDFT"<<endl;
cin>>choice;
if(choice >=2) {
cout << "Invaild Choice" << endl;
return 0;
}
cout<<"Enter the length of Signal N = "<<endl;
cin>>n;
calc calc_obj(n);
idft idft_obj;
dft dft(n);
cout<<"Enter the Signal real part coefficients"<<endl;
for(int i=0;i<n;i++){
cin>>x[i];
}
cout<<"Enter the signal imaginary co-efficients"<<endl;
for(int i=0;i<n;i++){
cin>>y[i];
}
if(choice==0){
dft.setC(n,x);
dft.setS(n,y);
dft.calcDFT(n);
}
else if(choice==1){
calc_obj.setC(n,x);
calc_obj.setS(n,y);
idft_obj.calcIDFT(calc_obj);
}
else{
cout<<"Invalid Choice"<<endl;
}
return 0;
};