This is part of my instructions and what i'm trying to code at the moment...
· To accelerate slowly, the user presses ‘a’. This will increase the speed by 3mph.
· To accelerate quickly, the user presses ‘A’. This will increase the speed by 10mph.
// I have not tried reading in the 10mph yet... just the 3mph...
Code:
#include <stdio.h>
#include <math.h>
int increase(int z, int y)
{
printf("|---------------------|\n");
printf("| %d |\n", total=total+num);
printf("| |\n");
printf("| |\n");
printf("|---------------------|\n");
return z=z+y;
}
int main(){
int i=0;
int num=3;
int total=0;
char number;
printf("\nEnter in an a to increase by 3 mph ,or a capital A to increase by 10mph!");
number=getch();
while(i<1){
switch (number)
case 'A':
case 'a':
int increase(total=total+num));
break;
i++;}
getch();
return(0);
}