Автор: Luxury31 (21.12.2008 в 15:46)
Помощь нужна срочно, пожалуйста!!!вот код программы! нужно вставить счетчик!
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <conio.h>
#include<conio.h>
#include<iostream.h>
//сортировка вставками
void insert (int n, int x[])
{
int i, j, t;
for (i=0; i<n; i++)
{
t = x[i];
for (j=i-1; j>=0 && x[j]>t; j--)
{
x[j+1]=x[j];
}
x[j+1]=t;
}
}
int main()
{
int x[]= {4, 8,2,84,12,1};
int n=6;
insert(n, x);
for(int t = 0; t < n; t++)
{
cout << x[t] << " ";
}
getch ();
return 0;
}