you have to do either
int total = random_number;
or...
int total;
cin>> total;
note on the last one you cannot use it until the cin line occurs unless you initialze or set total to a number like this but usually this would be in a loop where the first time it would be a 0 and the seccond time it'd be whatever they wrote
int total=0;
//use total
cin >> total;