Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- setlocale(LC_ALL, "Russian");
- int size, k, x, i, r;
- cout << "Введите размер массива: ";
- cin >> size;
- if (!cin){
- cout << "Error";
- return 1;
- }
- cout << "\nВведите шаг: ";
- cin >> k;
- if (!cin){
- cout << "Error";
- return 1;
- }
- int *arr = new int[size];
- for (int i = 0; i<size; i++) {
- arr[i] = (rand() % 10 + 1);
- cout << arr[i] << "\t";
- }
- cout << endl;
- for (i = k; (i - size) < k;) {
- if (i<size) cout << arr[i] << "\t";
- else cout << arr[i-size]<<"\t";
- i++;
- }
- delete[]arr;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement