0

Hey, i've wrote a script that will test three diffrent sorting methods and display how much time each method took to complete in order to compare the diffrent methods. The problem is that i'm suppose to show the results inside a 2 dimentional graph, and i'm not that much of an expert in c++ and zero knowledge in c++ graphics, so i was wondering if someone could help me out, i'm using visual studio 2008.

here's what i have:

```
#include<ctime>
#include <cstdlib>
using std::rand;
using std::srand;
#include<iostream>
using namespace std;
void BubbleSort (int *q , int n)
{
int permut , i , aux;
do
{
permut = 0;
for(i=0 ; i<n-1; i++)
if(q[i]>q[i+1])
{
aux = q[i];
q[i] = q[i+1];
q[i+1] = aux;
permut = 1;
}
}while(permut==1);
}
void SelectionSort (int *q , int n)
{
int i , j , aux , imin;
for(i=0 ; i<n-1 ; i++)
{
imin = i ;
for(j=i+1 ; j<n ;j++)
if(q[j] < q[imin])
imin = j;
if(imin!=i)
{
aux = q[imin];
q[imin] = q[i];
q[i] = aux;
}
}
}
void InsertionSort (int*q , int n)
{
int i , j , k , newVal;
for(i=0 ; i<n ; i++)
{
newVal = rand();
j=0;
while((j < i) && (q[j] <= newVal))
j++;
for(k=i-1 ; k>=j ; k--)
q[k+1] = q[k];
q[j]=newVal;
}
}
int main()
{
double av1=0 , av2=0 , av3=0;
int i , j;
const int n1=10000 , n2=20000 , n3=30000;
int a1[n1] , b1[n1] , c1[n1];
int a2[n2] , b2[n2] , c2[n2];
int a3[n3] , b3[n3] , c3[n3];
srand(0);
for(i=0 ; i<10 ;i++)
{
for(j=0; j<n1; j++)
a1[j] = rand();
for(j=0; j<n2; j++)
a2[j] = rand();
for(j=0; j<n3; j++)
a3[j] = rand();
clock_t t1=clock();
BubbleSort(a1,n1);
clock_t t2=clock();
av1+=double(t2-t1);
clock_t t3=clock();
BubbleSort(a2,n2);
clock_t t4=clock();
av2+=double(t4-t3);
clock_t t5=clock();
BubbleSort(a3,n3);
clock_t t6=clock();
av3+=double(t6-t5);
}
cout<<"The average time of Bubble Sorting for 10000 elements is "<<av1/10<<endl;
cout<<"The average time of Bubble Sorting for 20000 elements is "<<av2/10<<endl;
cout<<"The average time of Bubble Sorting for 30000 elements is "<<av3/10<<endl;
cout<<endl<<endl;
av1=av2=av3=0;
for(i=0 ; i<10 ;i++)
{
for(j=0; j<1000; j++)
b1[j] = rand();
for(j=0; j<2000; j++)
b2[j] = rand();
for(j=0; j<3000; j++)
b3[j] = rand();
clock_t t1=clock();
SelectionSort(b1,n1);
clock_t t2=clock();
av1+=double(t2-t1);
clock_t t3=clock();
SelectionSort(b2,n2);
clock_t t4=clock();
av2+=double(t4-t3);
clock_t t5=clock();
SelectionSort(b3,n3);
clock_t t6=clock();
av3+=double(t6-t5);
}
cout<<"The average time of Selection Sorting for 10000 elements is "<<av1/10<<endl;
cout<<"The average time of Selection Sorting for 20000 elements is "<<av2/10<<endl;
cout<<"The average time of Selection Sorting for 30000 elements is "<<av3/10<<endl;
cout<<endl<<endl;
av1=av2=av3=0;
clock_t t1=clock();
InsertionSort(c1,n1);
clock_t t2=clock();
av1+=double(t2-t1);
clock_t t3=clock();
InsertionSort(c2,n2);
clock_t t4=clock();
av2+=double(t4-t3);
clock_t t5=clock();
InsertionSort(c3,n3);
clock_t t6=clock();
av3+=double(t6-t5);
cout<<"The average time of Insertion Sorting for 10000 elements is "<<av1/10<<endl;
cout<<"The average time of Insertion Sorting for 20000 elements is "<<av2/10<<endl;
cout<<"The average time of Insertion Sorting for 30000 elements is "<<av3/10<<endl;
cout<<endl<<endl;
system("PAUSE");
return 0;
}
```

What i'm looking for is somekind of a plugin or a script that will display these results inside a graph(in a pop up window maybe?!!)

Regards