What is the output of the following
#include <iostream>
using namespace std;
// Function prototypes
void fil1Array(char [], int);
void showArray(const char [], int);
int main ()
{
const int SIZE = 8;
char prodCode[SIZE] = {‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’, ‘0’,};
fillArray(prodCode, SIZE);
showArray(prodCode, SIZE);
return 0;
}
// Definition of function fill Array.
// (Hint: 65 is the ASCII code for ‘A’)
void fillArray(char arr[], int size)
{
char code = 65;
for (int k = 0; k < size; code++, k++)
arr[k] = code;
}
// Definition of function showArray.
void showArray(const char codes[], int size)
{
for (int k = 0; k < size; k++)
cout ≪ codes[k];
cout ≪ endl;
}
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Management Information Systems: Managing The Digital Firm (16th Edition)
SURVEY OF OPERATING SYSTEMS
Web Development and Design Foundations with HTML5 (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
- Direction: Complete the program below using case switch statement and single array with Function. Copy the source code and screen the sample output.PROGRAMMING //Single array - A group of consecutive memory locations of the same name and type, structures of related data items.//Array index always starts with zero.// Single array with function#include<iostream>using namespace std;// Function Nameint sumAll(int num[5]);void display(int num[5]);//Variable global declarationint x, sum=0, choice; int num[5];main(){// Save the input numbers to the memoryfor(x=0; x<=4; x++){ cout<<(" Enter a number: ");cin>>num[x];}cout<<"\nCHOICES: ";cout<<"\n 1.The sum of all numbers ";cout<<"\n 2. The sum of even subscripts"; cout<<"\n 3. The sum of even numbers ";cout<<"\n 4. The product of odd subscripts ";cout<<"\n 5. The product of odd numbers ";cout<<"\n 6. The highest number ";cout<<"\n 7. The lowest number ";cout<<"\n 8.…arrow_forwardcode and output screenshot is mustarrow_forwardLab Assignment Question 3-Program in C++ to take input size of array from user and then take input valeues of array and print the sum of values at even index in the array only.arrow_forward
- Example: Write a C++ program that calculates the sum and average of an initialized integer array. #include using namespace std;arrow_forwardvi) In C++, rotate the array given below to left by 2 places and print it in the output. int A[6] = {12, 34, 56, 78, 2, 21}; Expected Output: {56, 78, 2, 21, 12, 34}arrow_forwardPlease assist as far as you can. Not a big deal if programme does not run, help with the codes as far as possible.3arrow_forward
- -C++ Program to know the dublicate elements in array. Code with comments and output screenshot is must ( PLAGIARISM will not be tolerated)arrow_forwardIn c++ 2. Take an array and find the factorial of the individual elements in the array and print the difference between the max value and individual values.(positive integers) Sample input: 4-no. of elements 2 4 5 1 Output: 118 96 0 119arrow_forwarduse vectors not arrays pleasearrow_forward
- Part 1 //Program Statment: Write a program(in c++) that first reads an integer for the array // size , then reads numbers into the array, and displays distinct numbers (i.e.// if a number appears multiple times, it is displayed only once). (Hint: Read // a number and store it to an array if it is new. If the number is already in // the array, discard it. After the input, the array contains the distinct numbers.) Part 2 //Program statment: When array is created, its size is fixed. Occasionally, you//need to add more values to an array, but the array is full. In this case , you //may create a new larger array to replace the existing array. Write a function //with the header;// // int * doubleCapacity(const int *list, int size)// //The function returns a new array that doubles the size of the parameter list.arrow_forwardC++ Code: This function will print out the information that has been previously read (using the function readData) in a format that aligns an individual's STR counts along a column. For example, the output for the above input will be: name Alice Bob Charlie ---------------------------------------- AGAT 5 3 6 AATG 2 7 1 TATC 8 4 5 This output uses text manipulators to left-align each name and counts within 10 characters. The row of dashes is set to 40 characters. /** * Computes the longest consecutive occurrences of several STRs in a DNA sequence * * @param sequence a DNA sequence of an individual * @param nameSTRs the STRs (eg. AGAT, AATG, TATC) * @returns the count of the longest consecutive occurrences of each STR in nameSTRs **/ vector<int> getSTRcounts(string& sequence, vector<string>& nameSTRs) For example, if the sequence is AACCCTGCGCGCGCGCGATCTATCTATCTATCTATCCAGCATTAGCTAGCATCAAGATAGATAGATGAATTTCGAAATGAATGAATGAATGAATGAATGAATG and the vector namesSTRs is…arrow_forwardC++ LANGUAGE. Please indicate/show the: A. Output of undebug code B. The dibugged code C.Screenshot of debugged code 5. Explanantion (problem with code, what did you do to solve it) Note: use cout when debugging the c++ programarrow_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