Output message and random number
#include <iostream> #include <string> #include <cstdlib> // Prototypes of functions // void srand( unsigned int seed); // int rand(void); // or: //from ww w . j a va 2s . c om // #include <stdlib.h> using namespace std; // Introduces all names of namespace // std into the global scope. int main() { string message = "\nLearn from your mistakes!";// = cout << message << endl; int len = message.length(); cout << "Length of the string: " << len << endl; // And another random number: int b; srand(12); b = rand(); cout << "\nRandom number: " << b << endl; return 0; }