Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear
#include
// Function to retract the landing gear
void retractLandingGear() {
printf("Retracting landing gear...\n");
// Code to retract the landing gear
// This function should communicate with the airplane's hardware or simulation
// to retract the landing gear
}
// Function to extend the landing gear
void extendLandingGear() {
printf("Extending landing gear...\n");
// Code to extend the landing gear
// This function should communicate with the airplane's hardware or simulation
// to extend the landing gear
}
int main() {
int choice;
do {
printf("Select an option:\n");
printf("1. Retract landing gear\n");
printf("2. Extend landing gear\n");
printf("3. Quit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
retractLandingGear();
break;
case 2:
extendLandingGear();
break;
case 3:
printf("Exiting program...\n");
break;
default:
printf("Invalid choice. Please try again.\n");
break;
}
printf("\n");
} while (choice != 3);
return 0;
}
output:
