www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/03/06:28:25

Date: Mon, 3 Feb 1997 12:17:57 +0100 (MET)
From: Miguel Murillo <mmurillo AT ideafix DOT cps DOT unizar DOT es>
To: Pyro Technic <invid AT dmv DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: SIGSEV hates me
In-Reply-To: <32F56281.2014@dmv.com>
Message-ID: <Pine.LNX.3.95.970203121439.28766A-100000@ideafix.cps.unizar.es>
MIME-Version: 1.0

> // Test of geinus problem #2 for 9th grade math
> 
> #include <iostream.h>
> 
> 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 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019