Hi, I'm quite a beginner and not sure if I can be helpful in the future. But I'll try!
anyway, here is my problem...
I've been searching on the net & looking up books but still don't have a clue of how to get it work.
I have to simulate a Physics problem.
The task is to investigate how the system differs from temperature.
But the simulation was done at each constant temp,
such that I need to output the data from each simulation to Excel and compare by plotting graphs.
the following is the simplified version of my code (there were too many calculations)
this clearly just overwrite everything when I change the temperature!
I really need some help!
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main (void){
double T=10; //start from temp=10, up to temp=100
for (T=10; T<=100; T+=10){
//Want to assign the value of T to the BOLD part of the file name
ofstream outfile("results.xls_[B]temperature[/B].xls");
outfile << "loop \t E \t average"<<endl;
double E=0,average=0;
//set initial conditions at T
for (int i=1; i<1001; i++){
E += 1*T;
average = E/T;
outfile << i <<"\t"<< E <<"\t"<< average <<endl;
}
}
}