Nick0703

testing

Oct 18th, 2013
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.48 KB | None | 0 0
  1. /*************************filename here.c****************************
  2. Student Name: -------                        Student Number:  -------------
  3. Date: -------------                          Course Name: ------------------
  4. I have exclusive control over this submission via my password.
  5. By including this statement in this header comment, I certify that:
  6.      1) I have read and understood the University policy on academic integrity;
  7.      2) I have completed the Computing with Integrity Tutorial on Moodle; and
  8.      3) I have achieved at least 80% in the Computing with Integrity Self Test.
  9. I assert that this work is my own. I have appropriately acknowledged any and all material
  10. (data, images, ideas or words) that I have used, whether directly quoted or paraphrased.
  11. Furthermore, I certify that this assignment was prepared by me specifically for this course.
  12. ****************************************************************************/
  13. #include <stdio.h>
  14. #include <stdbool.h>
  15. #include <stdlib.h>
  16. #include <time.h>
  17.  
  18. int main(void)
  19. {
  20.     int randNum;
  21.     int guess;
  22.     int choice;
  23.     int input;
  24.     int score = 0;
  25.     bool value;
  26.    
  27.     printf("Thank you for playing the High and Low game.\n\n");
  28.  
  29.     do
  30.     {  
  31.    
  32.         srand (time(NULL));
  33.         randNum = (rand()%(14-2))+2;
  34.  
  35.         if (randNum >= 2 && randNum <= 10)
  36.         {  
  37.             printf("The current card is a %d.\n\n", randNum);
  38.         }
  39.         else
  40.         {
  41.             switch(randNum)
  42.             {
  43.                 case 11:
  44.                     printf("The current card is a Jack.\n\n");
  45.                     break;
  46.                 case 12:
  47.                     printf("The current card is a Queen.\n\n");
  48.                     break;
  49.                 case 13:
  50.                     printf("The current card is a King.\n\n");
  51.                     break;
  52.                 case 14:
  53.                     printf("The current card is an Ace.\n\n");
  54.                     break;
  55.             }
  56.         };
  57.  
  58.         do
  59.         {
  60.             value = true;
  61.             printf("Will the next card be higher(1) or lower(2)? (press 0 to quit)?\n\n");
  62.             scanf("%d", &choice);
  63.             switch(choice)
  64.             {
  65.                 case 0:
  66.                     input = 0;                
  67.                     break;
  68.                 case 1:
  69.                     input = 1;
  70.                     break;
  71.                 case 2:
  72.                     input = 2;             
  73.                     break;
  74.                 default:
  75.                     printf("Please enter the correct input!\n");
  76.                     value = false;
  77.             };
  78.         }
  79.         while(!value);
  80.        
  81.         if (input = 1)
  82.         {
  83.         /* The guess should be higher here but how do I do that?
  84.         like (input>randNum) or (randNum>Num)?
  85.         */
  86.         };
  87.         if (input = 2)
  88.         {
  89.         /* Same problem */
  90.         };
  91.  
  92.     }
  93.     while(input != 0);
  94.  
  95.     return 0;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment