How can I change this code so it will output for two or more values in an array like vec[vSize]={5000,3000,4000}; instead of one value so in this case I would get three outputs for each timing of the for loop?
Code:
#include< iostream >
#include< iomanip >
#include< cstdlib >
#include< ctime >
#include< cstdio >
#include< fstream >
const int vSize = 1;
using namespace std;
int main()
{
int vec[vSize]={5000};//,50000//,100000,200000,400000};
//Declare the clock variables
clock_t start,finish;
clock_t startAll;
//Declare and initialize all the variables
double duration;
//Declare the streams and the input and output files
ifstream inFile;
ofstream outFile;
inFile.open("input1.txt");
outFile.open("A:/output1.txt");
int Sum=0;
for (int iterationcountselector = 0; iterationcountselector < vSize; ++iterationcountselector)
{
start=clock();
for(int i =0; i < vSize ; i++)
{
Sum++;
outFile<< Sum<<endl;
}
}
/* finish=clock();
duration=(double)(finish-start)/CLOCKS_PER_SEC;
cout<<" "<< setw(4)<< duration;*/
finish=clock();
duration=(double)(finish-start)/CLOCKS_PER_SEC;
cout<<"Total Time Duration"<< duration<<" ms"<< endl;
for (iterationcountselector = 0; iterationcountselector < vSize; ++iterationcountselector)
{
for(int i =0; i < vSize; i++)
{
Sum++;
outFile<< Sum<<endl;
}
}
finish=clock();
duration=(double)(finish-start)/CLOCKS_PER_SEC;
cout<<"Total Time Duration"<< duration<<" ms"<< endl;
return 0;
}//end of main