this is what i have so far:
doesn't run properly though.
also im trying to store the sampled values in their respective files and use excel to plot the sampled x(t), y(t), and z(t)...how do i do that
my code:
Code:// Text File Writing (SIN and COS).cpp : main project file. define _USE_MATH_DEFINES #include <math.h> #include <iostream> #include <iomanip> using namespace std; int main() { FILE *f; double x,y,z,t; f=fopen("c:/data.txt","a+t"); ///is this where my excel file goes?? for(t = 0.0; t <= 6.0; t += 0.01) { // Make calculations based on t x = sin(2*M_PI*t); y = 2*sin(16*M_PI*t/3) + cos (2*M_PI*t/3); z = x*y; // Write a data point to the file fprintf(f,"%.5lf %.5lf %.5lf\n",x,y,z); //5 decimal places of precision //want to change this to cout? how do i do this? } fclose(f);




Reply With Quote