Date: Mon, 3 Feb 1997 12:17:57 +0100 (MET) From: Miguel Murillo To: Pyro Technic cc: djgpp AT delorie DOT com Subject: Re: SIGSEV hates me In-Reply-To: <32F56281.2014@dmv.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII > // Test of geinus problem #2 for 9th grade math > > #include > > void main() > { > char dummy; > int num2, temp, digit[3], j, i; Problem digit[3] ===> digit[0], digit[1], digit[2] but never digit[3] > float num1; > > for(i=1; i < 10000; ++i) > { > num1 = i; > num2 = i * 4; > for(j=3; j>=0; ++j) Problem j= 3,4,5,6,7, ... at Infinitum for(j=3; j>=0; --j) > { > temp = (int)num1 % 10; > digit[j]=temp; Problem using digig[3] > 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 << "."; > } > } Good luck Piro !! Miguel