Ok, here's v2.2.0. This adds a nifty new thing *the currently location is on the titlebar this time*. To find out all of the bugfixes, knownbugs, new features, please read the "readme.txt" file.

Printable View

- 10-07-2002QuantriziCalculator v2.2.0
Ok, here's v2.2.0. This adds a nifty new thing *the currently location is on the titlebar this time*. To find out all of the bugfixes, knownbugs, new features, please read the "readme.txt" file.

- 10-07-2002red_baron
looks cool

- E] iverse sin :)

though it still needs that string input thingy, but i like all the functions, good luck with adding new stuff ;) - 10-07-2002QuantriziQuote:

*Originally posted by red_baron*

**looks cool**

- E] iverse sin :)

though it still needs that string input thingy, but i like all the functions, good luck with adding new stuff ;)

Code:`char symbol[] = { *, /, +, - }`

char symbols[];

char symbol[] - holds the symbols

char symbols[] - used for comparison - 10-07-2002RoD
Good job man, good job.

- 10-07-2002TechWins
It should read

**B] Sine**since you have cos labeled as cosine and tan labeled as tangent.

Here are some other suggestions I have. Get rid of all the extra text. Yeah it looks better in some cases but in terms of a calculator I don't think it's needed. Ex. "Enter the angle that you would like to know the sin of" should be "Sin - Enter angle: ". Then have the angle value display as "Sin(angle_value) = sin_value" *angle_value would be the angle value entered and the sin_value would be the calculation of that input*.

Also, when someone enters 90 for finding the sin you should give an expected value return. You're already checking to see if the number doesn't equal zero, so if you know the value equals zerio just do a manual display for it.

Ex.

"Sin - Entger angle: 90"

"Sin(90) = 0 "

In a sense it's somewhat pre-dertemined what the output is going to be for when someone enters 90. *Try to do this with as many functions as you can that you would normally not return a value for because it equaled 0*

Another thing, most people like to find the sin and cos for a number. So you should give the option of the person to enter BC and be able to use the cos and sin function simutaneously, if you understand what I'm saying.

Include linear and quadtratic functions. Such is have the user enter the y, m, and b values for a linear function and you could tell them the x value or try to do vice versa. For the quadtratic functions you could try to find what the x intercepts are by having the user say what a, b, and c equal. All of these are do-able without using the string line format.

Other than that your program is coming along nicely. Keep up the good work (hint hint I want to be able to a have a nice fully functional, graphing calculator by the end of the month...j/k).:) - 10-08-2002Sebastiani
I'm not in the mood to debug this one but take a look at it, when i wrote it I remember it working fine, but I'm too lazy to test it right now...

Code:

float Multiply(float a, float b){ return a * b; }

float Divide(float a, float b){ return (!a || !b) ? 0 : a / b; }

float Add(float a, float b){ return a + b; }

float Subtract(float a, float b){ return a - b; }

float Calculate(char input[], float *runningTotal)

{

if(input == NULL || runningTotal == NULL) return 0;

static float initialized = *runningTotal = 0;

bool usingRunningTotal = true;

int max = strlen(input);

float (*functionStack[ max ])(float, float);

float floatStack[ max ];

int iter = 0, funCount = 0, fltCount = 0;

char temp[ max ], *s;

for( s = input; s != NULL; s++ )

{

if(isdigit(*s) || *s == '.')

{

usingRunningTotal = false;

temp[ iter++ ] = *s;

}

else

if(ispunct(*s) || *s == 0)

{

if( usingRunningTotal )

{

usingRunningTotal = false;

floatStack[ fltCount++ ] = *runningTotal;

}

else

{

temp[ iter ] = 0;

floatStack[ fltCount++ ] = atof(temp);

iter = 0;

}

if(!*s) break; //...end of input...

switch(*s)

{

case '*': functionStack[ funCount++ ] = Multiply;

break;

case '/': functionStack[ funCount++ ] = Divide;

break;

case '+': functionStack[ funCount++ ] = Add;

break;

case '-': functionStack[ funCount++ ] = Subtract;

break;

}

}

}

if( fltCount != (funCount + 1) ) return *runningTotal;

*runningTotal = floatStack[0];

for(iter = 0; iter < (fltCount - 1); iter++)

{ //...let's do some math...

*runningTotal = functionStack[ iter ]( *runningTotal, floatStack[ iter+1 ]);

}

return *runningTotal;

}

- 10-08-2002Quantrizi
Sebastiani> Ok, thank you. I'll debug it and stuff.

TechWins> Ok, I'll do that. The other idea about the "Sin (angle) " thing, good idea. I'll change around the stuff to do that. The slope stuff, will have to wait *not to long though*. I was planning on coding that yesterday.

Ride -or- Die> Thank you. I appreciate that.

Thanks to all that have replied. - 10-08-2002Sang-draxQuote:

*Originally posted by Sebastiani*

Code:`int max = strlen(input);`

float (*functionStack[ max ])(float, float);