Quote Originally Posted by miryellis
Okie now I'm a little confused which to change first....

Well I'm trying to change the getchar... but not sure where I've to put it in my code without the go to...

I know the code don't make any sense... but oh boy... im getting real confused.... any help would be great!
You can try to compact things a bit. Some of the functions calls could be improvised to cover more aspects of the program, and possibly eliminate the need for some of the user entry testing with if/else.

Code:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>

char welcome_msg(void)
{
   char choice;
   static int runOnce = 0;
   
   fflush(stdout);
   
   puts("Pick your number!\n");
   
   printf("Would you like to play %s (yes/no): ", (runOnce != 0 ? "again" : ""));
   scanf("%c", &choice);
   
   while(getchar() != '\n'){}   
   runOnce = 1;
   
   return (toupper(choice)); 
}

void num_display(void)
{
 
    printf("\nNum: %i  %i  %i  \n\n", rand() %10, rand() %10, rand() %10);
}

void goodbye_msg(void)
{
    printf("\nThank you for playing.\n");
}

int main(void)

{
    char ans;
     
    srand((unsigned)time(NULL)); 

    while((ans = welcome_msg()) == 'Y')
       num_display();     
 
    goodbye_msg();

   return(0);
}