[Im making a random word generator, so i use time.h library to use srand and generate a random number... If random number = 0, then char (principal)= 'hola'. But in CMD only shows the final character :( (Sorry for my bad english)
The code is:
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
int principal;
char principal1;
srand(time(NULL));
principal = rand() % 2;
if (principal == 0)
{
principal1 = 'hola';
cout << principal1 << endl;
}
system("pause");
return 0;
}