I need to produce the flags of Poland, Netherlands and Italy using these steps in C programming:   Use fprintf(stderr, ...) to prompt the user for input. 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. Use nested for loops to iterate through the image, and generate an image of the correct size as determined by the user’s input to width. 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 is the code I have so far: #include #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(){ //declaring variables int country_code; int width; int height; int i; //j, k, t; //asking for user input fprintf(stderr, "What country's flag do you want to create? "); fscanf(stdin,"%d",&country_code); fprintf(stderr,"What width (in pixels) do you want it to be? "); fscanf(stdin, "%d", &width); fprintf(stderr,"\nMaking country %d's flag with %d pixels...\n", country_code, width); i = 0; //Poland flag if((country_code == 1)){ void make_ppm_image(int country_code, int width); fprintf(stdout, "P6\n%d 400 255\n", width); for(i=0; i<400*400; i++){ printf("%c%c%c",255,255,255); printf("%c%c%c",255, 0, 0); } } fprintf(stderr, "Done!\n\n"); return(0); } //Netherlands flag if((country_code == 2)){ void make_ppm_image(int country_code, int width); } //Italy flag

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need to produce the flags of Poland, Netherlands and Italy using these steps in C programming:  

  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 user’s 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 is the code I have so far:

#include<stdio.h>
#include<stdlib.h>

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(){

//declaring variables
int country_code;
int width;
int height;
int i; //j, k, t;

//asking for user input
fprintf(stderr, "What country's flag do you want to create? ");
fscanf(stdin,"%d",&country_code);

fprintf(stderr,"What width (in pixels) do you want it to be? ");
fscanf(stdin, "%d", &width);

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

i = 0;

//Poland flag
if((country_code == 1)){
void make_ppm_image(int country_code, int width);
fprintf(stdout, "P6\n%d 400 255\n", width);
for(i=0; i<400*400; i++){
printf("%c%c%c",255,255,255);
printf("%c%c%c",255, 0, 0);
}
}
fprintf(stderr, "Done!\n\n");
return(0);
}
//Netherlands flag
if((country_code == 2)){
void make_ppm_image(int country_code, int width);
}

//Italy flag

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY