src/errorCheck.c
//this function loops though the input char array and checks for illegal inputs. if one is
//found, the calculation is terminates, an error message displayed and a prompt given for a 
//new input
this function loops though the input char array and checks for illegal inputs. if one is
found, the calculation is terminates, an error message displayed and a prompt given for a
new input
this function loops though the input char array and checks for illegal inputs . if one is found the calculation is terminates an error message displayed and a prompt given for a new input
int vibeCheck(char* input){
	int length = sizeof(input);
	int errorFound = 0;
	for (int i = 0; i<length; i++){
		if (isalpha(input[i]) != 0){
			if (input[i] != 'e' && input[i] != 'E' && input[i] != 'x' && input[i] != 'X'){
				if (input[i] != 'h' && input[i] != 'H' && input[i] != 'q' && input[i] != 'Q'){
					printf("Error: Illegal input!\n");
					errorFound = 1;
					break;
				}
			}
		}
		if (input[i] == '*' || input[i] == '+' || input[i] == '-' || input[i] == '/' || input[i] == '^' || input[i] == 'e'){
			if (input[i+1] != '(' && isdigit(input[i+1]) == 0 && input[i+1] != '-' && input[i+1] != 'x' && input[i+1] != 'X'){
				printf("Error: Illegal input!\n");
				errorFound = 1;
				break;
			}
		}
	}
	return errorFound;
}
int vibeCheck ( char * input ) { int length = sizeof ( input ) ; int errorFound = 0 ; for ( int i = 0 ; i < length ; i ++ ) { if ( isalpha ( input [ i ] ) != 0 ) { if ( input [ i ] != ' ' && input [ i ] != ' ' && input [ i ] != ' ' && input [ i ] != ' ' ) { if ( input [ i ] != ' ' && input [ i ] != ' ' && input [ i ] != ' ' && input [ i ] != ' ' ) { printf ( " \n " ) ; errorFound = 1 ; break ; } } } if ( input [ i ] == ' ' || input [ i ] == ' ' || input [ i ] == ' ' || input [ i ] == ' ' || input [ i ] == ' ' || input [ i ] == ' ' ) { if ( input [ i + 1 ] != ' ' && isdigit ( input [ i + 1 ] ) == 0 && input [ i + 1 ] != ' ' && input [ i + 1 ] != ' ' && input [ i + 1 ] != ' ' ) { printf ( " \n " ) ; errorFound = 1 ; break ; } } } return errorFound ; }
this function loops though the input char array and checks for illegal inputs.
this function loops though the input char array and checks for illegal inputs .
//i didnt assign input[i] to a variable as this was giving me some nasty memory issues, //sorry if it looks a bit messy //loop through the input //check if any illegal letters are inputted //check if illegal consectuve operators are inputted