All pastes #428245 Raw Edit

Something

public c v1 · immutable
·published 2007-04-07 12:14 UTC
rendered paste body
#include <stdio.h>#define ZERO 48#define NINE 57#define TRUE 1#define FALSE 0#define SPACE 32#define TAB 11int main() {      int c = 0;      int count = 0;      int i=0;      int dicerolls[5];      int precedingWhitespace = TRUE; //First char need no whitespace;      int incorrectinput=0;      int valuerange=0;      int numbervalues=0;      printf("Please enter dice values:\n");      while((c = getchar()) != EOF)      {          if(!((c >= ZERO && c <= NINE) || c==SPACE)){//                printf("Incorrect Input Format: %d\n", c);                incorrectinput=1;          }          if(c >= ZERO && c <= NINE){              c = c - 48;              if(!(c >= 1 && c <= 6))              {//                  printf("Value out of Range.\n");                  valuerange=1;              }              dicerolls[count] = c;              count++;              precedingWhitespace = FALSE;              if(count > 5){//                  printf("Incorrect Number of Values.\n");                  numbervalues=1;              }              else if(c == SPACE || c == TAB)              {                  if(precedingWhitespace == FALSE)                  {                      precedingWhitespace = TRUE;                  }              }          }          i++;      }      if (incorrectinput==1){         printf("Incorrect Input Format\n");         valuerange=0;         numbervalues=0;      }      if (valuerange==1){         printf("Value out of Range.\n");         numbervalues=0;      }      if (numbervalues==1){         printf("Incorrect Number of Values.\n");      }                 return(0);}