random number generator

Hello
So this is my program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//Steven Velazquez,Michael Reisenweber, Andrei Kuzmiankov
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int
additionQuestions(int max,int questions, int randomseed)
{
       int random1,answer=1,count=1,count2=1;
       srand(randomseed);
       while (answer!=-1&&(count2-1)<=questions)
       {
             count2++;
             random=rand()%max;
             random1=rand()%max;
             cout<<"How much is "<<random<<" plus "<<random1<<"?";
             cin>>answer;
             if(answer==-1)
               cout<<"You entered -1. exiting...";
             else{
               if(answer==random+random1)
               {
                   cout<<"\nYou said "<<random<<" + "<<random1<<" = "<<answer<<" ";
                   cout<<"Very good!\n";
                   count++;
               }
               else
               {
                   cout<<"\nYou said "<<random<<" + "<<random1<<" = "<<answer<<" ";
                   cout<<"No. Sorry, the correct answer is "<<random+random1<<endl;
               }
             }
       }
       return (count-1);
             
    
}
      

We have to link it to his program, which decides how many questions there will be(questions), max random(max), and the seed for srand(randomseed).
The problem is that his program returns 700 correct answers and mine only returns like 10-20, and i have no idea how to make it return more.
I can also upload the link file if something.
Topic archived. No new replies allowed.