|
From: Frazell T. <fr...@fl...> - 2001-01-02 05:28:35
|
Sorry i was an idiot i wasted everyones time trying to fix a bug that =
really was fixed by the lines of code i used to quit my prog. already =
well below is the updated code if anyone has ideas on how it can be more =
simple to present to other developers let me know
--------------------------------------PROGRAM =
CODE---------------------------------------------------------------------=
----------------------------------------
// Quadrilatric equation calculater
// Written by: Frazell Thomas
#include <stdio.h>
#include <math.h>
#include <windows.h>
int a,a_2,b,c,d,answer,sroot,answer_2,b_2,b_3,div,quit,quit1;
int value[10];
int ctr =3D 0;
int nbr;
char plus;
main()
{ =20
MessageBox (NULL, "This is Q-Calc BETA 1.1
Visit http://www.FrazellThomas.com" , "Q-Calc", 0 + MB_ICONASTERISK);
// Cpoyright and author information
// If you alter this program you must list me in the credits
// As the lead developer on this piece of software
// I would also request that any version you release
// Be forwarded to me at fra...@ya...
// To keep me from re-inventing the wheel (programming code u =
already
// Done)
// This software it under the GNU public license
printf("This program is designed to do quadratic equations =
only.\n");
printf("You are free to use this software as stated under the =
GNU\n");
printf("Public License (Avalible at GNU.org).\n\n");
printf("Version: Beta 1.1 12/12/2000 8:00PM EST.\n");
printf("Programmer: Frazell Thomas\n");
printf("Please visit http://www.frazellthomas.com\n\n");
// Input From User
printf("Please enter the number used to represent varible A: ");
scanf("%d", &a);
quit =3D 40000;
// if statement to prevent the divide error if the var. a is zero
if (a =3D=3D 0)
{
do
{
puts("\nSorry you entered 0 this will result in an error =
try again.");
puts("\n\nEnter 99 to quit: ");
scanf( "%d", &nbr);
value[ctr] =3D nbr;
ctr++;
}
while (ctr < 10 && nbr !=3D 99);
return 0;
} =20
printf("Please enter the number used to represent varible B: ");
scanf("%d", &b_3);
printf("Please enter the number used to represent varible C: ");
scanf("%d", &c);
//Raises varible b to the second power
a_2 =3D pow(b_3, 2);
// This is the part of out calc prog that does the work :O)
// please alter + sign before var. c to a - if needed and vic =
versa
sroot =3D (a_2 - 4 * a * c);
b_2 =3D b_3 * 2;
b =3D b_3 - b_2;
div =3D 2 * a;
answer =3D (b + sroot) / div;
answer_2 =3D (b - sroot) / div;
// Prints the answer
printf("\nThe Answer Is %d and %d\n ", answer, answer_2);
printf("\nThe square root of %d in this problem was %d\n ", b_3, =
sroot);
printf("\n%d To the second power is %d ", b_3, a_2);
=20
// While loop =20
do
{
puts("\n\nEnter 99 to quit: ");
scanf( "%d", &nbr);
value[ctr] =3D nbr;
ctr++;
}while (ctr < 10 && nbr !=3D 99);
return 0;
}
|