// MAKE IT RETURN A VALUE! int main(void){ int start, stop, sum; char tmp[10]; // where to tmp store row/column inputs w/ fgets // script description printf("This function will add all integers between two user specified integer inputs\n\n"); // user input for start printf("Please enter your first integer\n"); fgets(tmp, sizeof(tmp) - 1, stdin); sscanf(tmp, "%d", &start); //user input for stop printf("Please enter your second integer\n"); fgets(tmp, sizeof(tmp) - 1, stdin); sscanf(tmp, "%d", &stop); sum = incrementUp(start, stop); //incrementDown(START, STOP); // part(b) function declaration printf("Sum of values between %d and %d: %d\n", start, stop, sum); getchar(); return 0; }
//Main run, checks boundaries, wins, increments forward void runSnake() { switch(dir) { case 1: //up if(checkBoundaryUp()) { //printf("GAME OVER\n"); state = 0; // state 0 = game over } else incrementUp(); break; case 2: //right if(checkBoundaryRight()) { //printf("GAME OVER\n"); state = 0; } else incrementRight(); break; case 3: //down if(checkBoundaryDown()) { //printf("GAME OVER\n"); state = 0; } else incrementDown(); break; case 4: //left if(checkBoundaryLeft()) { //printf("GAME OVER\n"); state = 0; } else incrementLeft(); break; } }
// MAKE IT RETURN A VALUE! int main(void){ incrementUp(START, STOP); // part(a) function declaration incrementDown(START, STOP); // part(b) function declaration getchar(); return 0; }