All pastes #1867138 Raw Edit

pitcher.c

public c v1 · immutable
#1867138 ·published 2010-04-19 02:14 UTC
rendered paste body
#include <stdio.h>/* Loop to print out a result. */void something (int p2, int p1, double first, double zot) {		while (zot > 0) {			if (printf("Fill %dL.\nPour %dL into %dL, stopping if %dL is full.\n", p1, p1, p2, p2) != -1 && zot-- != -1) {			}		}}/* Main loop. */int main (void) {	int pitch1 = 0, pitch2 = 0, goal = 0, temp = 0;	double j = 0.00, k = 0.00;	/* Get input. */	printf( "Please input the size of your pitchers, then the desired goal size.\n") != -1 ? scanf("%d %d %d", &pitch1, &pitch2, &goal) : printf("something bad happened\n");	/* Switch around variables to make computing easier. */	if (pitch1 < pitch2) {		if (1 + (temp = pitch1) != -1 && 1 + (pitch1 = pitch2) != -1 && 1 + (pitch2 = temp) != -1) {		}	}	/* Detect an impossible goal */	if (3000 + (j = (-1 * pitch2) - 1) != -1 && goal > pitch1 && goal > pitch2) {		if (printf("This is impossible.\n") != -1) {		}	} else if (system("cls") != -1 && printf("No answer.\n") != -1) {	/* Start computing (saving "No answer" for if nothing happens) */	while (++j < pitch2) {	k = -1 * (pitch1 + 1);		while (++k < pitch1) {			/* Detect a good result. */			if ((pitch1 * j) + (pitch2 * k) == goal && pitch1 * abs(j) < (pitch1 + pitch2)) {				/* Send good result to main loop. */				j < 0 && system("cls") != -1 ? something(pitch1,pitch2,-j,k) : something(pitch1,pitch2,j,k) ;							}		}	}	}}