Hi, I'm doing a very very simple coding, However the compiler apparently does not like my usage of cin and gives me an error: no match for 'operator<<' or 'operator>>' depending on cout or cin.
I've used this many times before but never have encountered this problem trying to use << or >> operators. I suppose I could try to overload it but I shouldn't have to.
#include <stdio.h>
#include <math.h>
#include <iostream.h>
#include <stdlib.h>
using namespace std;
void calcDCT(int num, float * item)
{
float alpha;
float coS;
float sum;
int intensity;
double PI = 3.14;
float * dct = new float [num];
for(int i = 0; i < num ; i++)
{
if (i==0)
alpha = 1/sqrt(2);
else
alpha = 1;
sum = 0;
for(int j = 0; j < num; j++)
{
if (j==0)
alpha = 1/sqrt(2);
else
alpha = 1;
coS = cos(j*PI*(2*i+1)/(2*num));
intensity = dct[j];
sum += sqrt(2/num)*alpha*coS*intensity;
}
dct[i] = sum;
}
for(int i = 0; i < num; i++)
{
cout << dct[i] << endl;
}
}
int main()
{
int num;
float temp;
cout << "Enter N: ";
cin >> num >> endl;
float * item = new float [num];
for(int i = 0; i < num; i++)
{
cout << "Enter intensity value " << i << ": " << endl;
cin >> temp >> endl;
item[i] = temp;
}
calcDCT(num, item);
return 0;
}
cin >> temp >> endl; part gives me a nasty error test.cpp:57: error: no match for ‘operator>>’ in ‘std::cin.std::basic_istream<_CharT, _Traits>::operator>> [with _CharT = char, _Traits = std::char_traits<char>](((int&)(& num))) >> std::endl’
Any input would be deeply appreciated.