I am new to C++ and using functions is still a bit unclear. I have a program started as follows below, but I keep getting compile errors that I do not understand how to fix. I feel like this is a simple fix, but I just am not seeing how to fix it.
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int roll ();
int main()
{
srand(time(NULL));
int die1;
diel = int roll();
cout << die1;
}
int roll()
{
return rand()%6+1;
}
Then, the compile error
dice.cpp: In function ‘int main()’:
dice.cpp:15: error: ‘diel’ was not declared in this scope
dice.cpp:15: error: expected primary-expression before ‘int’
dice.cpp:15: error: expected `;' before ‘int’