Example of random function code using language c++


 #include  
 #include   
 // The main() function.  
 int main()  
 {  
 std::cout << "Compute a random number? (y/n) ";  
 char ans; s  
 td::cin >> ans;  
 if (ans == 'n')  
 goto done;  
 else  
 {  
 int ran = std::rand();  
 std::cout << ran;  
 }  
 done:  
 return 0;  
 }