Thought I would send an answer to your original post, though as you said 'goto' should not be used.
Code:
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main()
{
int x,y;
char o,n;
char ch;
startover:
printf("What do you want to do?\n");
printf("ADD, SUBTRACT, MULTIPLY OR DEVIDE\n");
printf("Enter the first letter\n");
ch = getchar();
printf("Please enter your value\n");
scanf("%d",&x);
printf("Please enter your second value\n");
scanf("%d",&y);
if (ch == 'a') printf("The value is %d\n",x+y);
if (ch == 'd') printf("The value is %d\n",x/y);
if (ch == 'm') printf("The value is %d\n",x*y);
if (ch == 's') printf("The value is %d\n",x-y);
printf("Would you like to go again?\n");
printf("Press ENTER to go again\n");
printf("\n");
rewind(stdin);
o = getch();
if (o == '\r') goto startover;
}
No doubt there may be some reason that rewind(); shouldn't be used, but for this example it works.
Can't see what 'math.h' is needed for.
getch() returns an int of the ASCII value of a key pressed on the keyboard but does not put it to the screen.
o is a char
so you could make o of type int and test for the ASCII value. ie '\r' would be 13.
so
int o;
if(o == 13) goto startover;
Hope this is useful
Dav