While following this Youtube tutorial (see the relevant code below) I get the following error:
error line 6
error: expected constructor destructor or type conversion before'('
What might cause this error and how do I solve it?
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <time.h>
void myfun(int);//using own function
myfun(8);//pow(4.0,10.0)
using namespace std;
int main()
{
double num1;
srand(time(0));// to get a true random number
double num2;
num1 = pow(3.0, 9.0);//2 to the power of 4
cout << num1 <<endl;
num2 = rand() %100;//random number out of 100
cout << "\nrandom number = " << num2 << endl ;
return 0;
}
void myfun(int x)
{
using namespace std;
cout << "my favourite number is " << x << endl;
}