I am getting an unexpected error.

hello guys , i am still a beginner and i am learning about random number generator and i am getting this error (error:expected primary-expression before '==' token.
anyway here is my code


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <string>
#include <iostream>
#include <random>
#include <ctime>
using namespace std;

int main (){
                                        
default_random_engine numberGenerator(time(0));     
uniform_int_distribution<int> diceroll(1 , 6);

                        

cout <<" I am rolling a "<<diceroll(numberGenerator)<<endl;

if (diceroll(numberGenerator)) == 6 {
 cout <<"Critical hit! WOW " <<endl;
}else {
    cout<<"You have lost"<<endl;
 }
return 0;
}
use bracket in next line after int main() and always start bracket from new line and after a bracket start coding from next line
@gulshan garg

That is a personal preference, people have different bracing styles.

@tarekhojeiri

You have a misplaced parentheses on line 16, the if condition must be inside parentheses.
@TheideasMan yup that was the mistake, thank you
Topic archived. No new replies allowed.