Guest User

Untitled

a guest
Jan 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3.  
  4. #ifndef PORT
  5.     #define PORT 3000
  6. #endif
  7.  
  8. u_short PORT_NUMBER = PORT;
  9.  
  10.  
  11. int manageSelection( int selection )
  12. {
  13. //  if( (selection > 5) || (selection < 1) )
  14.     if( (selection > 4) || (selection < 1) )
  15.         selection = 0;
  16.     return selection;
  17. }
  18.  
  19. void run() {
  20.     char user[512];
  21.     int selection = 0;
  22.     char supervisor[256];
  23.     char entry[1024];
  24.  
  25.     do
  26.     {
  27.         printf( "Please enter your username.\n" );
  28.         fgets( user, 512, stdin );
  29.     }
  30.     while( strcmp( user, "\n" ) == 0 );
  31.  
  32.     printf( "Please make a selection:\n"
  33.         "1) Resource seepage\n"
  34.         "2) Time dazzling\n"
  35.         "3) Facility husbandry\n"
  36.         "4) Client dress-up\n"
  37. //      "5) Perception buffs\n"
  38.           );
  39.     scanf( "%d", &selection );
  40.     scanf( "%*[^\n]" );
  41.     scanf( "%*1[\n]" );
  42.     selection = manageSelection( selection );
  43.  
  44.     printf( "Please enter the name of your supervisor.\n" );
  45.     fgets( supervisor, 512, stdin );
  46.  
  47.     switch( selection )
  48.     {
  49.     case 0:
  50.         printf( "Your supervisor will be notified of this.\n" );
  51.         break;
  52.     case 1:
  53.         printf( "Where is the seepage located?\n" );
  54.         fgets( entry, 1024, stdin );
  55.         break;
  56.     case 2:
  57.         printf( "Time is our most important resource. Explain.\n" );
  58.         fgets( entry, 1024, stdin );
  59.         break;
  60.     case 3:
  61.         printf( "We must promote facility synergy. What do you think about that?\n" );
  62.         fgets( entry, 1024, stdin );
  63.         break;
  64.     case 4:
  65.         printf( "What they don't know can't hurt them. Am I right or am I right?\n" );
  66.         fgets( entry, 1024, stdin );
  67.         break;
  68.     default:
  69.         printf( "Perception is the art of being someone you aren't. Who are you?\n" );
  70.         fgets( user, 1024, stdin );
  71.         break;
  72.     }
  73.    
  74.     return;
  75. }
Add Comment
Please, Sign In to add comment