#include<stdio.h> #include<conio.h> struct boat { int age; char name[30]; }passengerinfo[2]; void main() { clrscr(); int a; printf("\nEnter the number of tickets:"); scanf("%d",&a); for(int i=0;i<a;i++)> { printf("\nEnter name[%d]:",i+1); scanf("%s",&passengerinfo[i].name); printf("\nEnter age[%d]:",i+1); scanf("%d",&passengerinfo[i].age); } printf("\nThe boarders of the boats:"); for(i=0;i<a;i++)> { printf("\nName:%s",passengerinfo[i].name); printf("\tAge:%d",passengerinfo[i].age); } for(i=0;i<a;i++)> { if(passengerinfo[i].age>0&&passengerinfo[i].age<18) printf("\nFare=:100"); else if(passengerinfo[i].age>=18&&passengerinfo[i].age<60) printf("\nFare:=200"); else if(passengerinfo[i].age==0||passengerinfo[i].age>=60) printf("\nFare=:300"); else printf("\nIncorrect age"); } getch(); }
passengerinfo[2]
passengerinfo[10]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)