Видео к уроку.
Код к уроку.
// ConsoleApplication3.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; void add(int value, int *product,int &count) { product[count] = value; count++; } void insert(int value, int pos,int *product, int &count) { for (int i = count - 1; i >=pos; i--) product[i + 1] = product[i]; product[pos] = value; count++; } void print(int *product, int &count) { for (int i = 0; i < count; i++) cout << product[i]<<"\n"; cout << "------------------------------"; } int main() { int product[100]; int count = 0; add(1, product, count); add(3, product, count); add(5, product, count); insert(2,1, product, count); insert(4, 3, product, count); print( product, count); int a; cin >> a; return 0; }