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...
What is the output of the following code given the program was called using the command-line: a.out input.txt output.txt int main(int argc, char* argv[]) { cout << argc; return 0; } Select one: a. 1 b. 2 c. 3 d. 6 which asnwer it is
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...
Given the following program, which line(s) cause(s) output to be displayed on the screen? 1 // This program displays my gross wages. 2 // I worked 40 hours and I make $20.00 per hour. 3 #include <iostream> 4 using namespace std; 5 6 int main() 7 { 8 int hours; 9 double payRate, grossPay; 10 11 hours = 40; 12 payRate = 20.0; 13 grossPay = hours * payRate; 14 cout << "My gross pay is $" << grossPay <<...
____ 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...
1. Every C++ program must have: A. a cout statement B. function main C. a #include D. All of the above 2. main() is a method that is part of the ‘Standard Library’. T__ F__ 3. Inside a ‘Console Application’, a ‘Project’ may implement multiple ‘Solutions’. T__ F__ 4. The C++ source-code files are listed with the extension .sln. T__ F__ 5. It is recommended to start...
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...
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...