Airline reservation system

I am having trouble with my modifyPassenger method. I want the program to display an error message and allow the user to input another id when not found. Currently my code is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  void modifyPassenger(void) {
	int id;
	int i;

	printf("Enter passenger ID: \n");

	while (scanf("%d", &id) == 1) {
		if (id == p[i].pId) {
			printf("Found\n");
			printf(	"----------MODIFY PASSENGER---------\n");
			printf("Enter passenger's name: \n");
			scanf("%s", p[i].name);
			printf("Enter passenger's surname: \n");
			scanf("%s", p[i].surname);
			printf("Enter house name:\n");
			scanf("%s", p[i].homeAddress.houseName);
			printf("Enter street name:\n");
			scanf("%s", p[i].homeAddress.streetName);
			printf("Enter town:\n");
			scanf("%s", p[i].homeAddress.town);
			printf("Enter post code:\n");
			scanf("%s", p[i].homeAddress.postCode);

			puts("The following are the details inputted:");
				puts("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				printf("ID     : %d\n", p[i].pId);
				printf("Name   : %s\n", p[i].name);
				printf("Surname: %s\n", p[i].surname);
				printf("Address: %s, %s, %s, %s\n", p[i].homeAddress.houseName,p[i].homeAddress.streetName, p[i].homeAddress.town,
p[i].homeAddress.postCode);
			break;
		}
		i++;

	}
}
Topic archived. No new replies allowed.