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
Concept explainers
Question
Given variables category, heat, and voltage, declare and assign the following pointers:
- character pointer categoryPointer is assigned with the address of category.
- integer pointer heatPointer is assigned with the address of heat.
- double pointer voltagePointer is assigned with the address of voltage.
Ex: If the input is C 355 3.5, then the output is:
Product category: C
Operational limit: 355 degrees at 3.5 volts.
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
char category;
int heat;
double voltage;
/* Your code goes here */
cin >> category;
cin >> heat;
cin >> voltage;
cout << "Product category: " << *categoryPointer << endl;
cout << "Operational limit: " << *heatPointer << " degrees at " << fixed << setprecision(1) << *voltagePointer << " volts." << endl;
return 0;
}
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 3 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
- If the input is negative, make numltemsPointer be null. Otherwise, make numltems Pointer point to numltems and multiply the value to which numltems Pointer points by 10. Ex: If the user enters 99, the output should be: Items: 990 406554.2871636.qx3zqy7 1 #include 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13 14 15 16 17 int numItems Pointer; int numItems; cin >> numItems; /* Your solution goes here */ if (numItems Pointer == nullptr) { cout << "Items is negative" << endl; } else { cout << "Items: << *numItemsPointer << endl; } || 1 test passed All tests passedarrow_forwardDeclare an integer pointer variable intPointer. Initialize it to point to an int variablenamed someInt.Assign the value 451 to someInt and output (cout) the variable someInt and output (cout)the value pointed to by intPointer.Write an assignment statement that indirectly stores 900 into the value pointed to by intPointer.Output (cout) the value pointed to by intPointer and output (cout) the variable someInt,arrow_forwardC+++ CODE HELP WITH POINTER BASICS CODE TO DO THE FOLLOWING: In function DisplayRank(), if rankPointer is null, print "rankPointer is null.". Otherwise, print the value in the variable pointed to by rankPointer. End with a newline. Ex: If the input is Y D, then the output is: D #include <iostream>using namespace std; void DisplayRank(char* rankPointer) { /* Your code goes here */ } int main() { char rank; char* rankPointer; char action; rank = '0'; cin >> action; cin >> rank; if (action == 'Y') { rankPointer = &rank; } else { rankPointer = nullptr; } DisplayRank(rankPointer); return 0;}arrow_forward
- Look at the following C++ code and comment each line about how it works with pointer. int i = 33; double d = 12.88; int * iPtr = &i; double * dPtr = &d; // iPtr = &d; // dPtr = &i; // iPtr = i; // int j = 99; iPtr = &j; //arrow_forwardPointers and references are fully equivalent True Falsearrow_forwardWhat are some ways in which a reference and a pointer are alike?arrow_forward
- Would it be possible to use unique, shared or weak pointers in the code?arrow_forwardGiven variables category, heat, and voltage, declare and assign the following pointers: • character pointer categoryPointer is assigned with the address of category. • integer pointer heatPointer is assigned with the address of heat. • double pointer voltagePointer is assigned with the address of voltage. Ex: If the input is V 150 5.5, then the output is: Product category: V Operational limit: 150 degrees at 5.5 volts. 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} char category; int heat; double voltage; *Your code goes here */ cin>> category; cin >> heat; cin>> voltage; cout << "Product category: cout << "Operational limit: return 0; << *categoryPointer << endl; << *heatPointer << degrees at << fixed << setprecision (1) << *volarrow_forwardA pointer variable is just what it sounds like. What is its purpose? Exactly what does it mean to have a "dynamic array"? Pointers and dynamic arrays have what relationship?arrow_forward
- In C, in order to do operations to the data being referenced by a pointer you would need to use the (*) operator, which is called ______________ operator.arrow_forwardplase give me codearrow_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