Given the following declaration code:
char *fullName="Sonny Bono";
char *parts=fullName;
__________________
cout << parts;
Which line of code when put on the blank line will cause Bono to be printed to the screen? Assume there is 1 space between Bono and Sonny and the space should NOT be a part of the output.
1) fullName=new char[6];
2) parts += 6;
3) parts = fullName[6];
4) parts = fullName + 7;
5) parts = &fullName + 6;
As the parts variable represents the fullname (It points to it's address)
if we add parts 6 to it's pointer the address points to B
when we print it it will print Bono
Option 1 is not syntactically correct
Option 2 is correct
Option 3 we cannot assign value to a pointer
Option 4 will print ono
option 5 is also not possible
Given the following declaration code: char *fullName="Sonny Bono"; char *parts=fullName; __________________ cout << parts; Which line...
Question 23 Complete the programs by adding the lines or parts of lines that have been omitted, or show output. <<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>> Corporate Sales Data Output #include <iostream> #include <fstream> using namespace std; // Constant for array size const int SIZE = 12; // Declaration of the Division structure struct Division { Blank 1 // Division name A. Add code in this box Blank 2 // Quarter number B. Add code in this box Blank 3 // Quarterly sales...
____ 1. Assume you have the following declaration char nameList[100];. Which of the following ranges is valid for the index of the array nameList? a. 0 through 99 c. 1 through 100 b. 0 through 100 d. 1 through 101 ____ 2. Assume you have the following declaration int beta[50];. Which of the following is a valid element of beta? a. beta['0'] c. beta[0] b. beta['1'] d. beta[50] ____ 3. Suppose that sales is an array of 50 components of...
The following program simulates shuffling a deck of cards. (The line numbers are not ) part of the code). Without changing its functionality, rewrite the program by replacing the 2D array card [52] [2] with a double pointer char **card and replacing the code between line 12 and line 26 with a function. The function prototype could be void shuffleCards (char **, char [, char [) 1 7/Shuffling cards 2 4 using namespace std; 6 main() #include #include <cstdlib> <iostream>...
[IN JAVA] Copy the following code into your main.cpp and complete it public class Main { public static void main(String [] args) { int [] array1 = {5, 8, 34, 7, 2, 46, 53, 12, 24, 65}; int numElements = 10; System.out.println("Part 1"); // Part 1 // Enter the statement to print the numbers in index 5 and index 8 // put a space in between the two numbers and a new line at the end // Enter the statement...
17.9 Worksheet 7 (C++) Follow the instructions commented into the given template. int main() { int array1[20] = {3, 18, 1, 25, 4, 7, 30, 9, 80, 16, 17}; int numElements = 11; cout << "Part 1" << endl; // Part 1 // Enter the statement to print the numbers in index 4 and index 9 // put a space in between the two numbers cout << endl; // Enter the statement to print the numbers 3 and 80...
Assume that you will be given a *.txt file, which in the same format of RandSource.txt (attached). The file has three numbers at each line. Numbers are separated with a space. All number are in the range of [0, 50]. The first two numbers indicate a range. The third one shows number of random numbers to be generated in the range of first two numbers. The range always given in first < second order. If not, raise an error. For...
In C++ Do not use a compiler like CodeBlocks or online. Trace the code by hand. Do not write "#include" and do not write whole "main()" function. Write only the minimal necessary code to accomplish the required task. Save your answer file with the name: "FinalA.txt" 1) (2 pts) Given this loop int cnt = 1; do { cnt += 3; } while (cnt < 25); cout << cnt; It runs ________ times ...
Open BlueJ and create a new project (Project->New
Project...).
Create a new class named ListsDemo.
Open the source code and delete all the boilerplate code.
Type in the code to type (code to type with bigger font)
exactly as shown, filling in your name and the date in the places
indicated.
The code is provided as an image because you should type it in
rather than copy-paste. If you need the code as text for
accessibility, such as using a...
Parallelogram Program
Write a program that prints the following parallelogram pattern
given the the following two inputs.
Here are the rules:
Your program must work with any length greater than 1.
Your program must use the character the user inputs to draw the
parallelogram.
Your program must not use global variables or global code other
than a call to main().
Your program output must match my out
exactly. I have provided you with the
strings you need for the output...
so i have my c++ code and ive been working on this for hours
but i cant get it to run im not allowed to use arrays. im not sure
how to fix it thank you for the help
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...