o Input range of N values
o Create range_time_vector
o Input number_of_cases
o for each input in the range of inputs
· Set time_sum to zero
· Set time_average to zero
· For each case
§ Start the time
§ Execute the loop
§ End the time
§ Add the time difference to time_sum
o Calculate time_average = time_sum/ number_of_cases
o Store time_average in range_time_vector at input index
when I got to the point to "start the time" I just couldn't understand it. My previous programming classes ever did anything like this, so I have no idea what to do. Below is what I've been able to do so far:
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
int N =0;
int Range=0;
int NumberOfCases=0;
cout << "Enter N" <<endl;
cin >> N;
cout << "Enter Range" <<endl;
cin >> Range;
cout << "Number of cases" <<endl;
cin >> NumberOfCases;
vector<double> range_time_Vector(Range);
int K = N;
for(int i=0; i < Range; ++i)
{
double time_sum = 0.0;
double time_average = 0.0;
for (int m=1 ; m <= NumberOfCases; ++m)
{
cout << "for m=" << m << " K=" << K << endl;
}
}
return 0;
}
Is there anyone that can help me with this: My tutor wasn't even able to understand the directions, so I wasn't able to get help that much. Thanks!
Edited by ZekeDragon, 12 March 2010 - 04:06 PM.
Please use [code] tags.


Sign In
Create Account

Back to top










