Main.cc: In function 'int main()': Main.cc:5:2: error: expected ';' before 'int' int r=rand() % 3 + 1; ^ Main.cc:11:24: error: 'r' was not declared in this scope cout<<"随机数:" << r << endl; ^