In c. I want it to for has transit to print Y or N instead of 1 or 0 #include #include #include
Posted: Sat Nov 27, 2021 2:18 pm
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;
}
Posted: Sat Nov 27, 2021 2:18 pm
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;
}
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;
}