occurred:
error: invalid operands of types 'void' and 'int' to binary 'operator%'
I have no idea what this means. The source code is bellow.
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <math.h>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int nTimer;
- int nInput;
- int nRand;
- int nInRa;
- nTimer = 0;
- nRand = 1;
- nInRa = 0;
- cout << "Input a number" << endl;
- cin >> nInput;
- while(nTimer < 5){
- nInRa = srand(nRand)% 3 + 1;//error is on this line
- if(nInRa == 1){
- nInput = nInput + 1;
- }
- if(nInRa == 2){
- nInput = nInput + 2;
- }
- if(nInRa == 3){
- nInput = nInput + 3;
- }
- nTimer = nTimer + 1;
- nRand = nRand + 1;
- }
- cout << nInput;
- return 0;
- }
Thank you for any help!