
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![9 //Assume the following declarations and answer the questions below: <br/>
O int array[4] ={3,9,12,13};
1 int *ptr;
2 const char *str
3 //Write a for loop that will display all the elements of array on one line (no spaces
+ for(int i=0;i<4;i++){
"C++ is such fun!"; // there is one space between each word <br/>
5 cout<<array[i];
3 cout <« endl;
9 // Write a line of code that makes ptr point to the value 12 in array
e int*point=&array[12];
2 // Write a line of code to display the 13 using the ptr and pointer notation](https://content.bartleby.com/qna-images/question/bb045dfa-2c18-4fbf-8578-ccec796e086b/90fa4bcf-d63d-48e1-93d1-2b21c67ece86/41y3bi_thumbnail.png)
Transcribed Image Text:9 //Assume the following declarations and answer the questions below: <br/>
O int array[4] ={3,9,12,13};
1 int *ptr;
2 const char *str
3 //Write a for loop that will display all the elements of array on one line (no spaces
+ for(int i=0;i<4;i++){
"C++ is such fun!"; // there is one space between each word <br/>
5 cout<<array[i];
3 cout <« endl;
9 // Write a line of code that makes ptr point to the value 12 in array
e int*point=&array[12];
2 // Write a line of code to display the 13 using the ptr and pointer notation
![// Write a line of code to display the 13 using the ptr and pointer notation
*ptr=&array;
cout<<13;
cout << endl;
//Write one line of code that displays the complete string that str points to.
cout<<strstr(str,"i");
cout << endl;
//Write one line of code that displays the fifth element (the lowercase i) in the above
cout<<str[4];
cout <« endl;
// Write one line of code that will display the contents of array[2] using pointer notati
cout<<array[2];
cout << endl;](https://content.bartleby.com/qna-images/question/bb045dfa-2c18-4fbf-8578-ccec796e086b/90fa4bcf-d63d-48e1-93d1-2b21c67ece86/vtyhzln_thumbnail.png)
Transcribed Image Text:// Write a line of code to display the 13 using the ptr and pointer notation
*ptr=&array;
cout<<13;
cout << endl;
//Write one line of code that displays the complete string that str points to.
cout<<strstr(str,"i");
cout << endl;
//Write one line of code that displays the fifth element (the lowercase i) in the above
cout<<str[4];
cout <« endl;
// Write one line of code that will display the contents of array[2] using pointer notati
cout<<array[2];
cout << endl;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input: Interactive // Output: Error message or nothing #include <iostream> #include <string> using namespace std; int main() { // Declare variables string inCity; // name of city to look up in array const int NUM_CITIES = 10; // Initialized array of cities string citiesInMichigan[] = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"}; bool foundIt = false; // Flag variable int x; // Loop control variable // Get user input cout << "Enter name of city: "; cin >> inCity; // Write your loop here // Write your test statement here to see if there is // a match. Set the flag to true if city is found. // Test to see if city was not found to determine if // "Not a city in Michigan" message should be printed.…arrow_forwardWrite a function getNeighbors which will accept an integer array, size of the array and an index as parameters. This function will return a new array of size 2 which stores the neighbors of the value at index in the original array. If this function would result in returning garbage values the new array should be set to values {0,0} instead of values from the array.arrow_forward//main.cpp file #include <iostream> #include "helper.h" #include "sorting.h" using namespace std; int main() { unsigned int size; cout << "Enter the size of the array: "; cin >> size; int* Array = new int[size]; unsigned int choice = 0; do { fillRandom(Array, size); cout << "Choose your sorting algorithm:" << endl; cout << "1. Bubble Sort" << endl; cout << "2. Selection Sort" << endl; cout << "3. Insertion Sort" << endl; cout << "4. Merge Sort" << endl; cout << "5. Quick Sort" << endl; cout << "6. Shell Sort" << endl; //Optional cout << "Enter 0 to exit" << endl; cout << "Your choice: "; cin >> choice; cout << "Unsorted Array: "; print(Array, size); /***************************** TODO: Implement what you will do with the choice*****************************/ cout << "Sorted Array: "; print(Array, size); } while(choice!=0); delete [] Array; return 0; }…arrow_forward
- #include <iostream> #include <string> using namespace std; int main() { // Declare a named constant for array size here // Declare array here // Use this integer variable as your loop index int loopIndex; // Use this variable to store the batting average input by user double battingAverage; // Use these variables to store the minimim and maximum values double min, max; // Use these variables to store the total and the average double total, average; // Write a loop to get batting averages from user and assign to array cout << "Enter a batting average: "; cin >> battingAverage; // Assign value to array // Assign the first element in the array to be the minimum and the maximum min = averages[0]; max = averages[0]; // Start out your total with the value of the first element in the array total = averages[0]; // Write a loop here to access array values starting with…arrow_forwardQ# Describe what a data structure is for a char**? (e.g. char** argv) Group of answer choices A. It is a pointer to a single c-string. B. It is an array of c-strings C. It is the syntax for dereferencing a c-string and returning the value.arrow_forward23. In the C++ language write a program to find the product of all the elements present in the array of integers given below. int numArr[5] = {16,4, 8, 7, 12};arrow_forward
- m05B C++ Please extend my code to do the following: Write a brand new driver program that does the following: Creates a circle object circleOne at (0,0):5. Creates a pointer c1Ptr to circleOne Creates a circle object circleTwo at (-2,-2): 10 Creates a pointer c2Ptr to circleTwo Use greaterThan to check if circleTwo is bigger than circleOne and display results Declare an array of pointers to circles- circlePointerArray Call a function with signature inputData(circlePointerArray, string filename) that reads data from a file called dataLab4.txt into the array The following h-k are done in this function Use istringstream to create an input string stream called instream. Initialize it with each string that is read from the data file using the getline method. Read the coordinates for the center and the radius from instream to create the circles Include a try catch statement to take care of the exception that would occur if there was a file open error. Display the message “File Open Error”…arrow_forwardtypedef _people { int age; char name[ 32 ] ; } People_T ; People_T data [ 3 ]; Using string lib function, Assign 30 and Cathy to the first cell, Assign 40 and John to the second cell and Assign 50 and Tom to the third cell People_T *ptr ; Declare a pointer pointing to the structure data and print the age and name using the pointer. your output can be : 30 Cathy 40 John 50 Tomarrow_forwardA1: File Handling with struct C++ This program is to read a given file and display the information about employees according to the type of employee. Specifically, the requirements are as follows. Read the given file of the information of employees. Store the information in an array or arrays. Display all the salaried employees first and then the hourly employees Prompt the user to enter an SSN and find the corresponding employee and display the information of that employee. NOTE : S- salaryemployee , H- Hourly employee S 135-25-1234 Smith Sophia DevOps Developer 70000H 135-67-5462 Johnaon Jacob SecOps Pentester 30 60.50S 252-34-6728 William Emma DevOps DBExpert 100000S 237-12-1289 Miller Mason DevOps CloudArchitect 80000S 581-23-4536 Jones Jayden SecOps Pentester 250000S 501-56-9724 Rogers Mia DevOps Auditor 90000H 408-67-8234 Cook Chloe DevOps QAEngineer 40 45.10S 516-34-6524 Morris Daniel DevOps ProductOwner 300000H 526-47-2435 Smith Natalie DevOps…arrow_forward
- Complete the code below to display all values inside the customers_per_hour std::vector. Display each value in a separate line (using std::endl or "\n"). #include #include int main() { std::vector customers_per_hour {2, 4, 1, 4, 3, 2, 1, 1}; for (int customers : customers_per_hour) { std::cout << customers << "\n"; } return 0; } #include #include int main() { std::vector customers_per_hour {2, 4, 1, 4, 3, 2, 1, 1}; for (int customers : customers_per_hour) { std::cout << customers << "\n"; } return 0; } #include #include int main() { std::vector customers_per_hour {2, 4, 1, 4, 3, 2, 1, 1}; for (int customers : customers_per_hour) { std::cout << customers << "\n"; } return 0; }arrow_forwardC++ Array Expander -Just do everything in main and make sure you comment each step Use Pointer Notation for the function and within the function. Use a main function and return the pointer from the ArrayExpander function to mainarrow_forwardGame of Hunt in C++ language Create the 'Game of Hunt'. The computer ‘hides’ the treasure at a random location in a 10x10 matrix. The user guesses the location by entering a row and column values. The game ends when the user locates the treasure or the treasure value is less than or equal to zero. Guesses in the wrong location will provide clues such as a compass direction or number of squares horizontally or vertically to the treasure. Using the random number generator, display one of the following in the board where the player made their guess: U# Treasure is up ‘#’ on the vertical axis (where # represents an integer number). D# Treasure is down ‘#’ on the vertical axis (where # represents an integer number) || Treasure is in this row, not up or down from the guess location. -> Treasure is to the right. <- Treasure is to the left. -- Treasure is in the same column, not left or right. +$ Adds $50 to treasure and no $50 turn loss. -$ Subtracts…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education