i know that it is not good to use goto but i just want to learn every single command that c programming has so please try not to flame a newbie.. thanx..
anywayz i am tring to make this code work with the goto command but it is not working can anyone tell me why... thanx
please dont change my code cause i really dont know alot about c yet then i will get confused...Code:
#include <stdio.h>
int main()
{
int x,y;
char ok;
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("Type in ok to go again or no to exit\n");
scanf("c",&ok);
if (ch == ok) goto startover;
return 0;
}