Mail Archives: djgpp/1997/02/02/21:06:28
I think that getch is defined in either stdio.h or stdlib.h or other
standard c header file, try including it.
On Sun, 2 Feb 1997, Pyro Technic wrote:
> My prog is a stupid little prog for a math problem. It's due in 14
> hours. I need help bad.The prog, B low, compiles w/ just 1 warning
>
> D:\PROGS>gxx -o TOG.exe TOG#2.cpp
> TOG#2.cpp: In function `int main(...)':
> TOG#2.cpp:30: warning: implicit declaration of function `int getch(...)'
>
> when run though it immediately exits and just leaves this
> Exiting due to signal SIGSEGV
> Stack Fault at eip=00001603
> eax=00003dbc ebx=00003dbc ecx=00000000 edx=00000000 esi=00000054
> edi=00020954
> ebp=00060928 esp=000608dc program=
> cs: sel=00a7 base=83dff000 limit=0006ffff
> ds: sel=00af base=83dff000 limit=0006ffff
> es: sel=00af base=83dff000 limit=0006ffff
> fs: sel=0087 base=0000bf10 limit=0000ffff
> gs: sel=00bf base=00000000 limit=ffffffff
> ss: sel=00af base=83dff000 limit=0006ffff
>
> Call frame traceback EIPs:
> 0x00001603
>
>
> This is the program.
>
> <here>
> // Test of geinus problem #2 for 9th grade math
>
> #include <iostream.h>
>
> void main()
> {
> char dummy;
> int num2, temp, digit[3], j, i;
> float num1;
>
> for(i=1; i < 10000; ++i)
> {
> num1 = i;
> num2 = i * 4;
> for(j=3; j>=0; ++j)
> {
> temp = (int)num1 % 10;
> digit[j]=temp;
> num1 /= 10;
> num1 -= (temp/10);
> }
> num1 = 0;
> num1 = digit[0];
> num1 += digit[1] * 10;
> num1 += digit[2] * 100;
> num1 += digit[3] * 1000;
> if(num1==num2)
> {
> cout << '\n' << num1 << " * 4 = " << num2 << "\nPush a key to
> continue" << flush;
> dummy = getch();
> }
> else
> cout << ".";
> }
> }
> <to here>
>
> please answer, I'm a desperate newbie. Thanks in advance.
>
> Pyro
>
- Raw text -