How to Write a C Program to greet a user with "Hello"-"Bye" and Choose a Game in Casino Game in C Programming Language ?
Solution:
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int helloandbye(int hbdigit)
{
switch(hbdigit)
{
case 0:
{
char hello[256] = "\nWelcome to casino \"Pure null\" \n ";
printf("%s\n", hello);
break;
}
case 1:
{
char bye[256] = "\nGoodbye. Hope luck on your side!";
printf("%s\n", bye);
break;
}
}
return 0;
}
int gamechoose()
{
int gamedigit;
printf("Here you can choose some games\n");
printf("\n");
printf("1. Find lucky digit\n");
printf("\nChoose game what you want: ");
do {
gamedigit = getchar();
putchar(gamedigit);
} while ((gamedigit > 1) || (gamedigit < 1));
switch(gamedigit)
{
case 0:
{
printf("check");
}
}
}
int main()
{
helloandbye(0);
gamechoose();
helloandbye(1);
return 0;
}