Putting values from an Increment in C++ into Excel -


i trying put answers gained increment;

for(int i=0; i<=n; i++)   {   xnew = -i*(y+r1)/n; //calculation angles , output displayed user    ynew = pow((((y+r1)*(y+r1)) - (xnew*xnew)), 0.5);    cout<<"\n("<<xnew<<", "<<ynew<<")"<<endl;    angleb = acos(xnew/pow((pow(xnew, 2))+(pow(ynew, 2)), 0.5))*(180/pi);    cout<<"\nangle 'b' = "<<angleb1<<" degrees"<<endl;    anglev = acos(((pow(xnew, 2))+(pow(ynew, 2))+(pow(100, 2))-(pow(65, 2)))/(200*(pow(((pow(xnew, 2))+(pow(ynew, 2))), 0.5))))* (180/pi);    cout<<"angle 'v' = "<<anglev<<" degrees"<<endl;   angletheta1 = angleb - anglev;    cout<<"theta 1 = "<<angletheta1<<" degrees"<<endl;    angletheta2 =(asin(pow(((sin(anglev*pi/180))*(pow(((pow(xnew, 2))+(pow(ynew, 2))), 0.5))/65), 0.5)))*(180/pi);    cout<<"theta 2 = "<<angletheta2<<" degrees"<<endl;    } 

now, depending on value user chooses 'n', list of 'n' number of values appear. e.g. 2 co-ordinate (xnew, ynew), , 4 different angles if n = 2.

now, having trouble inputting these values excel, table of values headers appear. have tried write in csv. format, succeeded in getting excel display 1 value in each column, , not list of values wanted (when n>1).

we given code postgrad helper our project still hasn't helped.

// writing on text file    #include <iostream>    #include <fstream>    using namespace std;     int main () {    ofstream myfile ("h:\\test\\files\\example.txt");    if (myfile.is_open())    {        myfile << "this line.\n";        myfile << "this line.\n";        myfile.close();    }    else cout << "unable open file";    return 0;    } 

so, have suggestions on how put our calculated values onto excel, displayed in format specified above? again, hope question clear enough.

here code tried before (though did delete may not perfect) when got broken single values appear.

under int main(){

 std::ofstream file_out("test.csv"); 

and @ bottom (underneath code)

 file_out << "x, x2, x3" << std:endl;  file_out << x << ", " << x2 << ", " << x3 << std::endl; 

but x, x2, , x3 values specified above (i.e. angleb, xnew, etc. )

you going need table of values rather list work

remove cout instances , replace following.

cout<<angleb1<<" "<<anglev<<" "<<angletheta1<<" "angletheta2<<" "<<endl; 

you coule write list of headers file before loop runs


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -