Public feed #891223

Mine

public c v1 · immutable
Raw Edit
·published 2008-02-04 14:01 UTC
rendered paste body
#define _CRT_SECURE_NO_DEPRECATE 1#include <cstdio>#include <cctype>#include <string.h>#define BUFSIZE 512char getFirstName() {	char line[BUFSIZE];	int i;	int fail;	int count;	while (1) {		count = 0;		fail = 0;		printf("Enter the Student's First Name: ");		if(!fgets(line, BUFSIZE, stdin)) {			clearerr(stdin);		}				if ( isalpha(line[0]) ) {			if(line[0] == '-')				fail = 1;						if ( fail == 0 )				for (i=0; line[i] != NULL; i++) {					if( isalpha( line[i] ) ) {						count++;					}				}			if(line[count] == '-') {				fail = 1;			}			if ( fail == 0 )				return *line; //Crash crash boom		}	}}void main(){	printf("%s", getFirstName());}