C++ 6th Experiment (Basic Class) - Array 2

In this experiment, write 1 project on the computer, and you only need to write 2 projects on the computer.

Note: Strings in all projects are stored using character arrays.

This experiment thinking code Chapter 4 Array class example

[Item 1: Array operation] Define a non-repeating 10-element integer array a with initial values, use the bubble method to sort the array a and complete the following operations (written in a program)

1. Input a number x from the keyboard, delete the array element whose value is x in the a array;

2. Input a number x from the keyboard, insert x into the a array and the array a is still in order (completed on the basis of the first question);


[Item 2: Array Merge]

It is known that there are two ordered arrays A and B. Combine these two arrays into array C, and array C is still ordered, such as a[5]={1,3,8,9,10}, b[ 5]={2,3,4,5,6}, then c[10]={1,2,3,3,4,5,6,8,9,10}

[Project 3: Matrix Summation]

Write a program to find the sum of the elements on the two diagonals of the matrix a(3*3).

[Item 4: Character deletion] Delete all characters c (input from the keyboard) from the string s (input from the keyboard) delete (requires to use the character array definition, use the pointer to move (do not define a new array space to store)
. For example, the input s is "Hello the world", and the input character c is "o", then output Hell the wrld

[Item 5: String operation] Input two strings a and b from the keyboard, judge whether the two strings are equal, and connect the string a and the string b (that is, put the string b in the string a after) output.

[Item 6: String Insertion] Input a string a from the keyboard, and insert the string b (b[]="ab") after the largest character in the a string, and then enter the string a.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325650334&siteId=291194637