Write a
For example, for the input
−12 3 −12 4 1 1 −12 1 −1 1 2 3 4 2 3 −12 |
the output should be
N Count 4 2 3 3 2 2 1 4 −1 1 −12 4 |
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Programming in C
Computer Systems: A Programmer's Perspective (3rd Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Absolute Java (6th Edition)
Artificial Intelligence: A Modern Approach
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
- In C program language, You are to read 10 numbers from a data file into an array named List. Create another 10 element array named Reverse that is to contain the same items as List but in reverse order. For example, the first element in List will be placed in the last position of Reverse, the second element in List will be placed in the second-to-last position in Reverse, etc. After Reverse has been created, output the contents of both arrays.arrow_forwardGiven a file of unsorted words with mixed case: read the entries in the file and sort those words lexicographically. The program (in c++) should then prompt the user for an index, and display the word at that index. Since you must store the entire list in an array, you will need to know the length. The "List of 1000 Mixed Case Words" contains 1000 words. You are guaranteed that the words in the array are unique, so you don't have to worry about the order of, say, "bat" and "Bat."arrow_forwardIn statistics the mode of a set of values is the value that occurs most often. Write a program that determines how many pieces of pie most people eat in a year. Set up an integer array that can hold responses from 30 people. For each person, enter the number of pieces they say they eat in a year. Then write a function that finds the mode of these 30 values. This will be the number of pie slices eaten by the most people. The function that finds and returns the mode should accept two arguments, an array of integers, and a value indicating how many elements are in the array.arrow_forward
- In C language pleasearrow_forwardThis program asks the user to enter 4 names for a team,storing them in an array of Strings.Then the program changes the array, replacing the firstteam member with Craig. Then this modified list ofnames is printed on the screen. You can see sampleoutput at the end of this file. 1) inputTeam: Input and return an array of Strings,with the specified number of elements (one int parameter).2) substitute: Has 3 parameters: an array of Strings,and two String names. Changes the array by replacing theelement containing the nameToRemove with the nameToAdd.3) outputArray: Has 1 parameter: an array of Strings.Outputs all the array elements, separated by spaces. import java.util.Scanner; class Main{ public static void main(String[] args) { String[] team; String nameToRemove, nameToAdd; System.out.println("Please enter 4 names for this team:"); team = inputTeam(4); nameToRemove = team[0]; nameToAdd = "Craig"; System.out.println("Sorry, we need to replace " + nameToRemove…arrow_forwardI need to write a program named Search.java that uses a function called search_string to check whether a string exists in the array or not. 1- The array of strings is iterated using a for loop and the value at every index is compared with the value to be searched in the array. 2- A boolean variable is set if any array value matches with the string. 3- At the end of the loop, this boolean variable is checked to determine if the array contains the string. It may be necessary to import java.util.Arrays then use Arrays.toString, String equals(). Output should be as picture showsarrow_forward
- Using c++ write a program Program : Date Printer Write a program that reads a char array from the user containing a date in the form mm/dd/yyyy. It should print the date in the form March 12, 2014. For example Enter Date 5/14/2019 May 14, 2019 Validation Required: Month should be less than 13, day should be less than 31.arrow_forwardIn C language please. You are to read 10 numbers from a data file into an array named List. Create another 10 element array named Reverse that is to contain the same items as List but in reverse order. For example, the first element in List will be placed in the last position of Reverse, the second element in List will be placed in the second-to-last position in Reverse, etc. After Reverse has been created, output the contents of both arrays.arrow_forwardAn array index can be of data type; a. int b. float O c. double O d. any typearrow_forward
- C++ LANGUAGE Write a program that asks for two integers X and Y as input and creates two arrays with sizes X and Y using calloc. Then, ask for the elements of the two arrays using a loop of your preference and concatenate the two arrays into one. Elements in X must come first. One line containing an integer for the size of the array X Print the concatenated elements inside a pair of square brackets [ ] where each elements are separated by a comma and a space. At the end of the program, don't forget to free the memory space. Input 1. One line containing an integer for the size of the array X 2. One or more lines containing an integer for the elements of array X 3. One line containing an integer for the size of the array Y 4. One or more lines containing an integer for the elements of array Y OUTPUT: Enter size of array 1: 3 Enter element 1: 1 Enter element 2: 2 Enter element 3: 3 Enter size of array 2: 2 Enter element 1: 4 Enter element 2: 5 [1, 2, 3, 4, 5]arrow_forwardAt the end of this and other textbooks, there usually is an index that lists the pages where a certain word appears. In this problem, you will create an index for a text but, instead of page number, you will use the line numbers. You will implement function index() that takes as input the name of a text file and a list of words. For every word in the list, your function will find the lines in the text file where the word occurs and print the corresponding line numbers (where the numbering starts at 1). You should open and read the file only once Create the python function as part of a python program. The data required for the function should be created in the python program and passed to the function. its an exercise pyrthon problem 6.27arrow_forwardWrite a C++ program that reads a list of numbers from a file into an array, then uses that array to find the average of all the numbers, the average of the positive and negative numbers (0 is neither positive nor negative!), and the largest number. The point is to be able to store data in an array and do things with it Your program must contain at least the following four functions... read_list() This function will take as input parameters an array of integers and a string filename. It will open that file and read in numbers, storing them in the array, stopping at the end of the file. Remember that there are tricky issues with extra whitespace at the end of the file. You can assume the file contains only integers. The function will return the number of numbers that were read in.Note: In versions of Visual C++ pre-2010, when using the open function with a string argument, you must call the c_str() function on the string variable, such as:my_input_stream.open( filename.c_str() ) 2.…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT