Sunday, July 12, 2009

Can anyone give me C++ code of Graphic Calculator?

I need the code for constructing graphs of sin,cos,tan,exponential ,equations and pi in the C++ language. The equations should be of user input. Thanks


Ashwin

Can anyone give me C++ code of Graphic Calculator?
I doubt someone is going to plop down the answers for your high school programming class here (but maybe).





Anyway, here is a plotting library. The standard edition is free.


http://www.softintegration.com/download/





I also found this sine wave code to get you started:





#include %26lt;stdio.h%26gt;


#include %26lt;math.h%26gt;


// We need to output stuff, and we need the sine function int main()


{


// declarations


int x;





char y[80];





// setting entire array to spaces


for(x = 0; x %26lt; 79; x++)


y[x] = ' ';


y[79] = '\0';


// print 20 lines, for one period (2 pi radians)


for(x = 0; x %26lt; 20; x++)


{


y[39 + (int) (39 * sin(M_PI * (float) x / 10))] = '*';


printf("%s\n", y);


y[39 + (int) (39 * sin(M_PI * (float) x / 10))] = ' ';


}


// exit


return 0;





}





Good luck!

hamper

No comments:

Post a Comment