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 (8th Edition)
Additional Engineering Textbook Solutions
Modern Database Management (12th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Database Concepts (8th Edition)
Programming in C
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- ii) What will be the maximum element of the array given below if the first k elements are removed from the array. Input the value of k from the user. int A[] = {34, 67, 1, 89, 156, -12, 78, 100, 23}; Programming languages: C/C++arrow_forwardDirection: 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_forwardprogram Credit Card Validator - Takes in a credit card number from a common credit card vendor (Visa, MasterCard, American Express, Discover) and validates it to make sure that it is a valid number (look into how credit cards use a checksum) - it's a C++ program so use #include <iostream> - And please use an array, use files, and use pointers in this program. -arrow_forward
- Lab 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_forwardDownload the file Ackermann.cpp. Inside the file the recursive Ackermann function is implemented (described in Chapter 14 Programming Challenge 9). Do the following and answer the three questions: a) Run the program. What happens?b) Now uncomment the code that is commented out and run the program again. What happens now?c) What do you think is going on?arrow_forwardwrite a function that performs this array manipulation with the given parameters. array manipulation: original array = {1,2,3} array after function = {1,2,2,3,3,3} void array_manip( unsigned int*& array, size_t& size) { } please use C++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_forwardC Programming Write function updateHorizontal to flip the discs of the opposing player, it should do the following a. Return type void b. Parameter list i. int rowii. int col iii. char board[ROW][COL] iv. Structure Player (i.e. player) as a pointer c. If the square to the left or right is a space, stop checking d. If the square to the left or right is the same character as the player’s character, stop checking e. If the square to the left or right is not the same character as the player’s character, flip the disc (i.e. X becomes O, O becomes X) Write function updateVertical to flip the discs of the opposing player, it should do the following a. Return type void b. Parameter list i. int rowii. int col iii. char board[ROW][COL] iv. Structure Player (i.e. player) as a pointer c. If the square above or below is a space, stop checking d. If the square above or below is the same character as the player’s character, stop checking e. If the square above or below is not the same character as…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