Answer:
This is an example of a simple C program that implements the Angry Birds game based on the theory of parabolic shooting. It calculates the distance travelled by a projectile based on the firing speed and angle entered by the user, and determines whether the projectile hit the target or not.
Step-by-step explanation:
#include <stdjson.h>
#include <stdio.h>
#include <math.h>
#define SHOOTING_SPEED 10
#define FIRING_ANGLE 45
#define DISTANCE_RANGE 5.0
#define TARGET_ERROR_RANGE 2.0
void get_input_parameters();
void calculate_distance_travelled_by_projectile();
void report_game_outcome();
int main()
{
int i = 0;
char win_loss[10];
get_input_parameters();
do
{
calculate_distance_travelled_by_projectile();
report_game_outcome();
i++;
} while (i < 10);
if (win_loss[i] == 'w')
{
printf("WIN\\");
}
else if (win_loss[i] == 'l')
{
printf("LOSS\\");
}
else
{
printf("INVALID INPUT\\");
}
return 0;
}
void get_input_parameters()
{
float firing_speed, angle;
printf("Enter firing speed (m/s): ");
scanf("%f", &firing_speed);
if (firing_speed < 0.0 || firing_speed > 10.0)
{
printf("Invalid firing speed, please enter a value between 0.0 and 10.0.\\");
get_input_parameters();
}
printf("Enter angle (degrees): ");
scanf("%f", &angle);
if (angle < 0.0 || angle > 180.0)
{
printf("Invalid angle, please enter a value between 0.0