Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ please! Given three integers on input, follow the instructions in the code to arrive at the correct answer. Given three integers on input,

In C++ please!

Given three integers on input, follow the instructions in the code to arrive at the correct answer.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Given three integers on input, follow the instructions in the code to arrive at the correct answer. Sample Input: 20 60 40 Sample Output: The sum of the inputs are 120 The final answer is 100 main.cpp Load default template... 9 1 //This lab gives a student practice in programming C++ pointers 2 #include 3 using namespace std; 4 5 int main() 6 { 7 //create three integer variables and then read the values from cin, also create a variable that will store 8 //the smallest of the three int vali, val2, val3, smallest; 10 11 //this code is incomplete, finish it 12 cin >> vall; 13 14 15 //create three variables that are pointers to integers, call them ptri, ptr2, and ptr3. 16 //This is incomplete. Finish it. 17 int* ptri; 18 19 1/dynamically allocate three chunks of memory that will be used to store integer values. 20 //One statement is provided, you finish it 21 ptr1 = new int; main.cpp Load default template... //Write code to store the input values (vali, val2, and val3) into the memory addresses that // (ptri, ptr2, and ptr3) are pointing to. Finish this section, it is incomplete. *ptr1 = vali; 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 //The following statement will sum the three input values by derefrencing the three pointer variables. //Check the output here to make sure it is accurate. This is a check point for you. int answer = *ptrl + *ptr2 + *ptr3; cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions