MCPcopy Create free account
hub / github.com/Rustam-Z/cpp-programming / main

Function main

Lab_08/deleting.cpp:4–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int main()
5{
6 int a[10];
7 int n = 10;
8 cout << "Input numbers for into arrays." << endl;
9 for (int i = 0; i < n; i++)
10 {
11 cout << "a[" << i << "] = "; // input array
12 cin >> a[i];
13 }
14 int value;
15 int position;
16 cout << "Enter value which you want to delete: ";
17 cin >> value;
18 for (int i = 0; i < n; i++)
19 { // finding the position
20 if (value == a[i])
21 position = i;
22 }
23 for (int i = position; i < n; i++)
24 { // incrementing the array elements into 1
25 a[i] = a[i + 1];
26 }
27 n = n - 1;
28 for (int i = 0; i < n; i++)
29 {
30 cout << "a[" << i << "] =" << a[i] << endl; // output arrays with correct order
31 }
32 a[9] = 0;
33 return 0;
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected