Getting a Build failed Error in Clion

I am facing an issue in Clion while going through the C++ tutorial - Ultimate C++ Part 1: Fundamentals. In the chapter “Generating Random Number” after compiling, I am getting am error “Build Failed” while I am executing the code. Below is the code that I am compiled:


#include
#include
#include

using namespace std;

int main() {
const short MaxValue = 6;
const short MinValue = 1;

srand(time(0));
short first = (rand() (MaxValue - MinValue +1)) + MinValue;
short second = (rand() (MaxValue - MinValue +1)) + MinValue;

cout << first << ", " << second;

return 0;

}


Any idea how to solve it:

There is no modulus (%) operator in between.

Syntax:
rand() % value;

1 Like

Thanks for the help.