Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdbool.h>
- int main()
- {
- //printf("Hello world!\n");
- char address[30];
- char *pizzas[8]={"AA", "BB", "VV", "GG"};
- char name[20];
- char id_data[40];
- char telephone[10];
- char last[6]="finish";
- int i;
- while(true)
- {
- printf("\n Hello. What's your address?");
- scanf("%s", &address);
- if(address==last)
- {
- break;
- }
- else
- {
- printf("\n Menu for today: ");
- for(i=0;i<4;i++)
- {
- printf("\n %s", pizzas[i]);
- }
- printf("\n What's your choice: ");
- scanf("%s", &pizzas);
- printf("\n What's your name: ");
- scanf("%s", name);
- printf("\n What's your phone: ");
- while(true)
- {
- scanf("%s", &telephone);
- bool is_wrong=false;
- if(strlen(telephone)!=10)
- {
- is_wrong=true;
- }
- if(telephone[0]!='0' && telephone[1]!='8')
- {
- is_wrong=true;
- }
- if(is_wrong==true)
- {
- printf("\n Input new phone number: ");
- //scanf("%s", &telephone);
- }
- else
- {
- break;
- }
- }
- printf("\n %s, you ordered pizza: %s", name, pizzas);
- printf("\n To address: %s", address);
- printf("\n Your phone is: %s", telephone);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement