Originally Posted by
Matticus
Regarding this question:
Look at your "do-while" loop. What are you telling the program to do in that loop?
1. print arrow
2. read a single character
3. if that character is not 'q', then go back to #1
Do you see what's happening? What will your program do if you enter several characters at once? You need a minor re-structuring of code in that function.
Onto the bigger issue:
Are you sure you understand the requirements and limitations of your assignment? Based on the sample you've provided, this would be obscenely difficult - nay, downright futile - to implement. You might want to clarify the requirements.
http://postimage.org/image/wz3u2702f
That is the requirements.
I have moved on a little, but still i am facing problem.
for now i am not starting the custom cmd prompt ("> ") , i will put that after.
now i am testing a new function for the first two input
Code:
#include <stdio.h>
void firstInput (void)
{
int x, y, *pNum1, *pDem1;
char letter1, *pVar1;
pVar1 = &letter1;
pNum1 = &x;
pDem1 = &y;
printf("> ");
scanf ("%c:%d/%d", &letter1, &x, &y);
printf( "%d/%d is %c\n", *pNum1, *pDem1, *pVar1);
}
void secondInput (void)
{
int a, b, *pNum2, *pDem2;
char letter2, *pVar2;
pVar2 = &letter2;
pNum2 = &a;
pDem2 = &b;
printf("> ");
scanf ("%c:%d/%d", &letter2, &a, &B)/>/>/>;
printf( "%d/%d is %c\n", *pNum2, *pDem2, *pVar2);
}
int main (void)
{
printf("~~~ CALCULATOR ~~~\n");
firstInput();
secondInput();
return 0;
}
OUTPUT:
~~~ CALCULATOR ~~~
> X:3/4
3/4 is X
> Y:12/5
3/4 is
I don't know what i am doing wrong. I am totally lost.