You are here:

C++/query in c++(about random() function)

Advertisement


Question
what output will this code produce?
main()
{
randomize();
char area[][10]={"NORTH","SOUTH","EAST","WEST"};
int togo;
for(int i=0;i<3;i++)
{
 togo=random(2)+1;
 cout<<area[togo]<<":";
}
return 0;
}


Answer
> what output will this code produce?

a cascade of compiler errors.

error: ISO C++ forbids declaration of `main' with no type

error: 'randomize' undeclared (identifier not found)

error: 'random' undeclared (identifier not found)

error: 'cout' undeclared (identifier not found)

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.