
Concept explainers
How do I remove duplicate elements in an 2d array (C++)?
This is my code, but it does not work:
const int TEST1_NRULES = 4;
const int MAX_WORD_LENGTH = 20;
char test1win[4][MAX_WORD_LENGTH+1] = {
"stop", "no", "no", "no"
};
char test1wout[4][MAX_WORD_LENGTH+1] = {
"family", "po", "lp", "bro"
};
for (int i = 0; i < TEST1_NRULES; ++i) {
for (int p = i + 1; p < TEST1_NRULES; ++p) {
if (strcmp(test1win[i], test1win[p]) == 0) {
for (int k = i; k < TEST1_NRULES; ++k) {
for (int j = 0; j < MAX_WORD_LENGTH; ++j) {
test1win[k][j] = test1win[k + 1][j];
test1wout[k][j] = test1wout[k + 1][j];
}
}
}
}
}

Step by stepSolved in 2 steps

- int [] arrayInt={3,54,90,22,32}; To print the last element in the arrayInt you will write: a. System.out.println(arrayInt[5]); b. System.out.println(arrayInt[0]); c. System.out.println(arrayInt[length]); d. System.out.println(arrayInt[4]);arrow_forward. Given the following parallel arrays: int[] arrProdNumber = new int[] { 100, 115, 125, 142, 163, 199, 205, 388 }; string[] arrProdDesc = new string[] { "Kitten", "Cat", "Bird", "Chicken", "Dog", "Puppy", "Aardvark", "Zebra" }; Write a C# program that includes these arrays. Your program should then read a product number from the user and search the product number array for that number. If it is found, then your program should report the product number they entered and the corresponding product description. If the product number they enter is not in the first array, then your program should indicate that item number was not found. Here’s a sample run: //first runEnter product number: 115Item #115's product description is Cat//second runEnter product number: 1963Item #1963 does not exist in your inventory Some Random Number Generation HintsRandom rndNumber = new Random();Console.WriteLine(rndNumber.Next()); //random integerConsole.WriteLine(rndNumber.Next(101)); //random integer…arrow_forwardProblem Description - JAVA PROGRAMMING Use a Two-dimensional (3x3) array to solve the following problem: Write an application that inputs nine numbers, each of which is between 1 and 10, inclusive. Display the array after the user inputs each value. Rotate/flip the array by changing places. Make the rows columns and vice versa. You have to move the elements to their new locations. Remember to validate the input and display an error message if the user inputs invalid data. Documentation and the screenshot(s) of the results. Example: 1 2 3 4 5 6 7 8 9 the result will be : 1 4 7 2 5 8 3 6 9arrow_forward
- Review the code snippet. if numbersomeArray. Index { print (someArray[number]) print("Array index is out of range") else { What array property is used to return the size of the array? Complete the code by entering the property in the box.arrow_forwardwrite only the code required to multiply the number 8 to each array value in the array and print the results on the console Int[][] myArray = {{23, 54, -21}, {11, 35, 42}, {7, 18}}; //write your code herearrow_forward1. How would you initialize a 2D array of doubles called height Weight that represents the height and weight of the 25 members of the UNC Charlotte football team? (select all that apply) A. double[][] heightWeight = new double[25] [25]; B. double[][] heightWeight = new double[25][2]; C. double[] heightWeight = new double[50]; D. double[][] heightWeight = new double[2][25];arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





