Skip to content

Instantly share code, notes, and snippets.

@jose-villegas
Forked from skrite0/gist:3f3d306600340aec43a4
Last active August 29, 2015 14:13
Show Gist options
  • Save jose-villegas/c19858510e472b84fd31 to your computer and use it in GitHub Desktop.
Save jose-villegas/c19858510e472b84fd31 to your computer and use it in GitHub Desktop.
/*
* File: main.cpp
* Author: Anon
*
* Created on January 10, 2015, 11:11 AM
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
char *names(int num);
/*
*
*/
int main(int argc, char** argv)
{
srand (time(NULL));
int randomValue = rand() % (6 - 1) + 1;
printf("Name(%d) : %s", randomValue, names(randomValue));
return 0;
}
char *names(int num)
{
char *name;
switch (num)
{
case 1 : name = "Martin"; break;
case 2 : name = "Jordan"; break;
case 3 : name = "Avery"; break;
case 4 : name = "Max"; break;
case 5 : name = "Logan"; break;
case 6 : name = "Garry"; break;
default : name = "Invalid Input!";
}
return name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment