Write C+ + statement(s) to do the following: (1, 2)
Declare an array alpha of 50 components of type int.
Initialize each component of alpha to -1.
Output the value of the first component of the array alpha.
Set the value of the 25th component of the array alpha to 62.
Set the value of the 10th component of alpha to three times the value of the 50th component of alpha plus 10.
Use a for loop to output the value of a component of alpha if its index is a multiple of 2 or 3.
Output the value of the last component of alpha.
Output the value of the alpha so that 15 components per line are printed. i. Use a for loop to increment every other element (the even indexed elements). j. Create a new array, diffAlpha, whose elements are the differences between consecutive elements in alpha. What is the size of dif fAlpha?
Trending nowThis is a popular solution!
Chapter 8 Solutions
EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
- Can someone please explain this C++ code that my classmate did line by line please. Also, incase you needed further explanation the prompt is as follows: Implement an empty integer array of capacity 5. a) Use a loop to input values from the console into the array. b) Use a loop to determine the smallest element in the array. c) Use a loop to determine the largest element in the array. d) Use a loop to output the array. e) Output the smallest and largest elements. Example Output (input in bold italics)[0] = 4[1] = 24[2] = 123[3] = 54[4] = 3 Array: 4 24 123 54 3 Max: 123Min: 3arrow_forwardC++ Coding: Nested Loops Create a constant DIM. Set DIM to 7, and use a nested loop to display the following square matrix output. Output Example: - - - X - - -- - - X - - -- - - X - - -X X X O X X X- - - X - - -- - - X - - -- - - X - - -arrow_forwardCode in C++ please.arrow_forward
- Suppose you have the following array: int findtarget[10] = { 4, 3, 100, 3, 1, 5, 10, 90, 9, 101 }; Write a C++ program that will use a for loop to find a target value, and count the number of times if it found the target. If it finds the target value, print "Found Target" to output with the number of occurrences for the target. The target value will be entered as input. For example, using the array above, here is an example of the program run: Enter a target value: 3 Found Target Number of Occurrences: 2arrow_forwardComputer sciencearrow_forwardComputer Science This is a Microprocessor And Assembly Language Question .Write the code for the question in 8086x emulator.arrow_forward
- Write code that uses any type of loop. The code should continually ask for a user input and sums all user inputs that are divisible by 2. The loop should continue until the user enters a negative number. The code should output the sum a single time once user entry has completed. You may assume all libraries and namespaces have been previously written into the code, you are just writing everything that would go inside the main function (beyond the return 0:).arrow_forward2. Test Scores File: test_scores.py Write pseudocode for the main() part of a program that asks the user to enter 4 test scores between 0 and 100, then displays a JCU grade for each score and also the average test score. When you have written the pseudocode for main, implement your solution in Python code and test it with a range of meaningful data. Remember that we've done the JCU grades question before, so copy your function from that practical code file. Sample Output Score: 3 Score: 50.5 Score: 66 Score: 100 Score 3.0, which is N Score 50.5, which is P Score 66.0, which is C Score 100.0, which is HD The average score was 54.875 Enhancements When you have that working... We asked for 4 scores. Have a look at your code... did you use 4 as a numeric literal or a constant?Change 4 to 3... Did you have to change the program in more than one place?If so, then you've missed one of the things we've taught...As a strong guideline: if you need to use the same literal more than once, you…arrow_forwardC++arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage