All pastes #2087219 Raw Edit

lab6.

public text v1 · immutable
#2087219 ·published 2011-10-05 22:53 UTC
rendered paste body
#include <stdio.h>

int main (void)
{
	int width;
	int country_code;
	
void make_ppm_header(int width, int height)
{	fprintf(stdout, "P6\n";
	fprintf(stdout, %d %d %d\n", width, height, 255);
}

	/*Read image dimensions and pixel color*/

	void make_pixel (
		int r, //red intensity
		int g, //green intensity
		int b ) //blue intensity
{
	fprintf(stdout, "%c%c%c", r, g, b);
}

	fscanf(stdin, "%d %d", &country_code, &width);
	fprintf(stderr, "Making country %d width %d \n", country_code, width);


	/*Write the image data*/

	make_ppm_image(country_code, width);

while (count < (width * height))
{
	fprintf(stdout, "%c%c%c", r g, b);
        count = count + 1;
}

	return(0);
}

void make_ppm_header(int width, int height)
{
	fprintf(stdout, "P6\n");
	fprintf(stdout, "%d %d 255\n", width, height);