この Youtube チュートリアル(以下の関連コードを参照) に従っていると、次のエラーが発生します。
エラー行 6
エラー: '(' の前にコンストラクターのデストラクタまたは型変換が必要です
このエラーの原因と解決方法を教えてください。
#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;
}