Question: c++ 1. Given the following code, what would you add to this code in so that the value of 5 is written out to the

c++

1. Given the following code, what would you add to this code in so that the value of 5 is written out to the screen?

#include

int main(){

int* number = new int(5);

//missing code

delete number;

}

2. What, if anything, is wrong with the code below?

#include

int main() {

int a = 1;

int b = 2;

int c = add(a,b);

}

int add(int num0, int num1){

return num0 + num 1;

}

3. Write code that will create an array of twelve floats and add random values to that array. Then print out those values to the console. There is no need to create any functions and you can assume that all necessary libraries have been imported.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!