//Nikolas Szymczyk
//CpSC 1011
//Section 004
//Lab7- Flag of Ireland

#include <stdio.h>

int main(void)
{
	
	struct header//struct for flag values
	{
		char label;
		int height, width, maxColor;
	};
	struct header flag;

	struct f//struct for color values
	{
		unsigned int r, g, b;
	};

	struct f color;

	fprintf(stderr, "What is the width you want for the flag?: ");//width of flag
	scanf(" %d", &flag.width);

	flag.height=flag.width/2;//height of flag

	fprintf(stderr, "Creating a flag with %d width and a %d height..\n", flag.width, flag.height);

	fprintf(stdout, "P3\n%d %d %d\n", flag.width, flag.height, flag.maxColor=255);//nexted for loop to get values

	for(int h=0;h<flag.height;h++)
	{
		for(int w=0;w<flag.width/3;w++)//red
		{
			color.r=255;
			color.g=0;
			color.b=0;
			printf(" %d %d %d", color.r, color.g, color.b);

		}
		for(int w=flag.width;w<flag.width*2/3;w++)//white
		{
			color.r=255;
			color.g=255;
			color.b=255;
			printf(" %d %d %d", color.r, color.g, color.b);
		}
		for(int w=flag.width*2/3;w<flag.width;w++)//orange
		{
			color.r=255;
			color.g=165;
			color.b=0;
			printf(" %d %d %d", color.r, color.g, color.b);

		}
		

	}
return(0);

};




	





