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
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