Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdbool.h>
  5.  
  6. int main()
  7. {
  8. //printf("Hello world!\n");
  9. char address[30];
  10. char *pizzas[8]={"AA", "BB", "VV", "GG"};
  11. char name[20];
  12. char id_data[40];
  13. char telephone[10];
  14. char last[6]="finish";
  15. int i;
  16. while(true)
  17. {
  18. printf("\n Hello. What's your address?");
  19. scanf("%s", &address);
  20. if(address==last)
  21. {
  22. break;
  23. }
  24. else
  25. {
  26. printf("\n Menu for today: ");
  27. for(i=0;i<4;i++)
  28. {
  29. printf("\n %s", pizzas[i]);
  30. }
  31. printf("\n What's your choice: ");
  32. scanf("%s", &pizzas);
  33. printf("\n What's your name: ");
  34. scanf("%s", name);
  35. printf("\n What's your phone: ");
  36. while(true)
  37. {
  38. scanf("%s", &telephone);
  39. bool is_wrong=false;
  40. if(strlen(telephone)!=10)
  41. {
  42. is_wrong=true;
  43. }
  44. if(telephone[0]!='0' && telephone[1]!='8')
  45. {
  46. is_wrong=true;
  47. }
  48. if(is_wrong==true)
  49. {
  50. printf("\n Input new phone number: ");
  51. //scanf("%s", &telephone);
  52. }
  53. else
  54. {
  55. break;
  56. }
  57. }
  58. printf("\n %s, you ordered pizza: %s", name, pizzas);
  59. printf("\n To address: %s", address);
  60. printf("\n Your phone is: %s", telephone);
  61. }
  62. }
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement