CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// DO NOT EDIT THIS PORTION
#include <iostream>
using namespace std;
void initialize(char e[21]);
void moveElement(char e[21], int movement);
void displayElements(char e[21]);
int main() {
char elements[21];
int movement=-1;
initialize(elements);
displayElements(elements);
do {
cin >> movement;
moveElement(elements, movement);
displayElements(elements);
} while (movement != 0);
return 0;
}
void displayElements(char e[21]) {
for (int i=0; i<21; i++)
cout << e[i];
cout << endl;
}
// PLACE YOUR CODE UNDER THIS COMMENT
void moveElement(char e[21], int movement) {
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run