Question
Given variables cargoLabel, cradleCount, and cradleWeight, declare and assign the following pointers: character pointer cargoLabelPointer is assigned with the address of cargoLabel. integer pointer cradleCountPointer
Given variables cargoLabel, cradleCount, and cradleWeight, declare and assign the following pointers:
character pointer cargoLabelPointer is assigned with the address of cargoLabel.
integer pointer cradleCountPointer is assigned with the address of cradleCount.
double pointer cradleWeightPointer is assigned with the address of cradleWeight.
Ex: If the input is B 178 181.5, then the output is:
Cargo B contains 178 cradles of 181.5 pounds each.
#include
int main() { char cargoLabel; int cradleCount; double cradleWeight; /* Your code goes here */ cin >> cargoLabel; cin >> cradleCount; cin >> cradleWeight;
cout << fixed << setprecision(1); cout << "Cargo " << *cargoLabelPointer << " contains " << *cradleCountPointer; cout << " cradles of " << *cradleWeightPointer << " pounds each." << endl;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started