All pastes #802005 Raw Edit

Stuff

public text v1 · immutable
#802005 ·published 2007-11-29 21:13 UTC
rendered paste body
#include <stdio.h> 
#include <stdlib.h>

int main(int argc, char **argv) {
	FILE *point; 
	char blub;
	int w,l,b,d;
	char inp;
	inp = NULL;
	d = w = l = b = 0;
		
	if(argc>1) {
		point = fopen(argv[1], "r");
		}
	if(argc==1) {
		point = stdin;
		}
	
	if(point == NULL) {
             fprintf(stderr, "Use auto-completiton!\n");
             return 0;
             }
	else {
	while(!feof(point)) {
		blub = fgetc(point);
		b++;
		
		if(blub > 33) {
			d = 0;
			}
		
		if(blub < 33) {
                if(d == 0) {
                     w++;
                     d++;
                     }
                if(blub == 10) {
                        l++;
                        }
                }
			}
	fclose(point);
	printf("%i \t %i \t %i \n",l, w-1, b-1);
	return 1;
	}
}