In c. I want it to for has transit to print Y or N instead of 1 or 0 #include #include #include

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In c. I want it to for has transit to print Y or N instead of 1 or 0 #include #include #include

Post by answerhappygod »

In c. I want it to for has transit to print Y or N instead of 1
or 0
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
struct domesticFlightsInfo
{
char destination[50];
char date[50];
char timee[50];
float price;
bool hasTransit;
int ID;
};
struct domesticFlightsInfo flightinfo()
{
struct domesticFlightsInfo Flight[3];
strcpy(Flight[0].destination, "San
Francisco");
strcpy(Flight[0].date, "On 12-06-2021");
strcpy(Flight[0].timee, "at 19:25.");
Flight[0].price= 192.22;
Flight[0].hasTransit= true;
Flight[0].ID= 1;
strcpy(Flight[1].destination, "New York
City");
strcpy(Flight[1].date, "On 12-01-2021");
strcpy(Flight[1].timee, "at 12:12.");
Flight[1].price= 495.11;
Flight[1].hasTransit= true;
Flight[1].ID= 2;
strcpy(Flight[2].destination, "Las Vegas");
strcpy(Flight[2].date, "On 12-24-2021");
strcpy(Flight[2].timee, "at 11:11.");
Flight[2].price= 111.11;
Flight[2].hasTransit= false;
Flight[2].ID= 3;
for(int i=0; i<3; i++){
printf("%d %s %s %s. Cost: $%f. Has transints: %d.
Flight ID is: %d.\n", (i+1), Flight.destination, Flight.date,
Flight.timee, Flight.price, Flight.hasTransit,
Flight.ID);
}
printf("\n");
return Flight[];
}
int main(){
flightinfo();
return 0;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply