Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve it in C++ You are required to write a code that takes two single-dimensional arrays ( arr1 and arr2) of 10 integer values and

Solve it in C++ image text in transcribed
image text in transcribed
You are required to write a code that takes two single-dimensional arrays ( arr1 and arr2) of 10 integer values and an integer value X, finds and prints the following: - The dot product of arr1 and arr2. The dot product is an algebraic operation that takes two equal-length single-dimensional arrays of numbers and returns the sum of the products of the corresponding entries in the two arrays. - The total number of times the value X appears in both arrays. - The largest index of the element in arr2 which has the same value of X. If the element does not exist, then the program prints -1. For example, if the entered arr 1 values are: {1,5,6,6,7,5,0,4,6,0} and the arr2 values are: {2,1,2,1,2,1,5,1,2,0} then the dot product =12+51+62+61+72+51+05+41+62+00=60. So, in case the value of X equals 1 , then the output would be as follows: 6057 IMPORTANT NOTE - Do not add any cout statements such as "Enter the values of arr1" except for the final answers as specified above. - You may add any libraries needed. HW6-B: Sorting C-String Characters In this question you are required to complete a function that receives a c-String as a parameter then sorts its characters as alphabets or not. In more details, the function receives a group of characters in a C-String without spaces. The function is supposed to print out a single line that contains the following: - All alphabets (A.Z or a.z) in their order in the C-String followed by all other characters in their order in the C.String without spaces - Number of alphabets - Number of other characters - The word Higher or Lower or Equal There must a single space between each two items, The last word shows if the number of alphabets is Higher, Lower, or Equal than the number of other characters in the C-String. For example, if C.String inCS a "Pay100sdaily", the the output should be: Paydaily100s 84 Higher Do not write and submit the main subroutine, or any include statments, these are aiready written and hidden from you. However, if you want to test your solution in any IDE (e.g., CodeBlocks, CLion, onlinegdbicom, then you will need to write your own main there for testing purposes. ismontANR NOIES - Do not change the given functoris header. - Do not add ary cout saternents in the fundion excepe fira the tinalinswer as spected abover - Do not add any unnecesary pices and follow the same format cesarding spaces and ietelest cise - Assuame estring and cstalib libranes are atready inchustid

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago