Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <conio.h>
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- using namespace std;
- void main()
- {
- int a[50], n, i, k;
- cout << "\nnhap so luong phan tu trong mang: ";
- cin >> n;
- while (n <= 0)
- {
- cout << "n phai lon hon 0, vui long nhap lai: ";
- cin >> n;
- }
- for (i = 1; i <= n; i++)
- {
- cout << "nhap phan tu cua mang: ";
- cin >> a[i];
- }
- cout << "nhap vi tri can xoa: ";
- cin >> k;
- for (i = k; i <= n-1; i++)
- {
- a[i] = a[i + 1];
- }
- for (i = 1; i<n; i++)
- cout << a[i] << " ";
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement