Question: Write a program called flags.c that is capable of creating an image of the flags of Poland, Netherland, and Italy. country_code should be 1, 2,

Write a program called flags.c that is capable of creating an image of the flags of Poland, Netherland, and Italy. country_code should be 1, 2, and 3 for Poland, the Netherlands, and Italy, respectively.

You will need to write the code to create the chosen flag. To do this youll need to:

1. Use fprintf(stderr, ...) to prompt the user for input.

2. Use an if-else, or switch statement based on the country_code and put the code to create the flags within each part of the if-else or switch, whichever you have chosen.

3. Use nested for loops to iterate through the image, and generate an image of the correct size as determined by the users input to width.

4. Determine what row and column the program is currently iterating through, and write the correct color based on where on the flag that is.

Here's my code so far:

#include

void make_pixel(int r,int g, int b);

void make_ppm_header(int width,int height);

void make_ppm_image(int country_code, int width);

int main(){

int width=0;

int country_code=0;

fprintf(stderr, "Enter the country_code of the chosen flag.(1 for Poland, 2 for Netherlands, 3 for Italy)");

fscanf(stdin, "%d", &country_code);

fprintf(stderr, "What width(in pixels) do you it be?");

fscanf(stdin, "%d", &width);

fprintf(stderr, " Making country %d's flag with width %d pixels... ",country_code,width);

return(0);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!