As others have said, this forum discusses the rules of C++, not general usage.
On Tuesday, October 29, 2013 1:01:13 PM UTC-4, Aparna Prasad wrote:
#include<iostream.h>
#include<stdlib.h>
int main()
{ int rnum,i;
for(i=0;i<5;++i)
cout<<(rnum=rand())<<endl;
return 0;
}
Q: How does rnum get its value since no number is taken as input nor it is declared?
To actually answer your question: unlike other languages, assignment is an expression instead of just a statement. rnum is assigned the return value of the latest rand() call, then rnum is passed to the operator << call with cout. rand() is declared in the <stdlib.h> header.
P.S
This is my program
i have copied this from my book(beginning random numbers)
If the book is from the era that <iostream.h> was around, it's way too old.
Daryle W.