I am working on a math tutor program that will generate two random numbers and display the result. I believe I have to use the srand() function to generate random number. The book mentions a seed value which I am a very unclear on. Could I get an explanation on what a seed value is? Below is the source that I have got so far.
Code:#include<iostream> #include<cstdlib> #include<cmath> using namespace std; int main() { int x,y,z; char(ch); x=rand(); y=rand(); z=x+y; cout<<"What is the sum of: "<<x<<" and "<<y<<endl; cout<<"Press a key of the answer!"<<endl; cin.get(ch); cout<<"The sum of: "<<x<<" and "<<y<<" is "<<z<<endl; system("pause"); return 0; }



LinkBack URL
About LinkBacks



