Advertisement
pdaogu

Ex5.3

Oct 9th, 2018
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.12 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main () {
  5.   int girl1 = 0, girl2 = 0;
  6.   int yourHei, tmp, delta;
  7.   char name1[30], name2[30];
  8.   printf("%*s%s%*s\n\n", 5, "", "Welcome to Chat & Choose", 5, "");
  9.   printf("Please login first! Enter your height(cm): ");
  10.   scanf("%d", &yourHei);
  11.   printf("\nYour first girl's name: ");
  12.   while(getchar() != '\n');
  13.   scanf("%[^\n]", name1);
  14.   printf("\nYour second girl's name: ");
  15.   while(getchar() != '\n');
  16.   scanf("%[^\n]", name2);
  17.   printf("\n-------------------------\n");
  18.   printf("Hello, %s\n", name1);
  19.   printf("Me: how old are you, %s?\n%s: ", name1, name1);
  20.   scanf("%d", &tmp);
  21.   girl1 += (delta = tmp > 16 ? (tmp >= 21 ? 5 : 2) : -2);
  22.   printf("(%d)\n", delta);
  23.   printf("Me: %s! And, what's your height?\n%s: ", tmp > 16 ? (tmp >= 21 ? "so sweet" : "so beautiful") : "so cute", name1);
  24.   scanf("%d", &tmp);
  25.   girl1 += (delta = tmp-yourHei >= -30 ? ((tmp-yourHei)>=0 ? -1 : 3) : -2);
  26.   printf("(%d)\n", delta);
  27.   printf("Me: %s\n", delta == -2 ? "What a cute little girl!" : (delta == 1 ? "Wow, you owned a beautiful figure!" : "You're really a sweet girl!"));
  28.   printf("\n-------------------------\n");
  29.   printf("Hello, %s\n", name2);
  30.   printf("Me: how old are you, %s?\n%s: ", name2, name2);
  31.   scanf("%d", &tmp);
  32.   girl2 += (delta = tmp > 16 ? (tmp >= 21 ? 5 : 2) : -2);
  33.   printf("(%d)\n", delta);
  34.   printf("Me: %s! And, what's your height?\n%s: ", tmp > 16 ? (tmp < 21 ? "so sweet" : "so beautiful") : "so cute", name2);
  35.   scanf("%d", &tmp);
  36.   girl2 += (delta = tmp-yourHei >= -30 ? ((tmp-yourHei)>=0 ? -1 : 3) : -2);
  37.   printf("(%d)\n", delta);
  38.   printf("Me: %s\n", delta == -2 ? "What a cute little girl!" : (delta == 1 ? "Wow, you owned a beautiful figure!" : "You're really a sweet girl!"));
  39.   printf("\n-------------------------\n");
  40.   printf("Time of the decision: \n");
  41.   char decision[100];
  42.   strcat(decision, girl1 > girl2 ? name1 : (girl1 < girl2 ? name2 : name1));
  43.   girl1 == girl2 ? strcat(decision, "?\nMe: are you free on Sunday, ") : 0;
  44.   girl1 == girl2 ? strcat(decision, name2) : 0;
  45.   printf("Me: are you free on Saturday, %s?\n", decision);
  46.   return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement