The answer to this question is B
Answer:
#include <iostream>
#include <vector>
using namespace std;
/* Define your function here */
vector<int> GetUserValues(vector<int>& userValues, int numValues) {
int tmp = 0;
vector<int> newVec;
for(int i = 0; i < numValues; i++) {
cin >> tmp;
newVec.push_back(tmp);
}
return newVec;
}
void OutputIntsLessThanOrEqualToThreshold(vector<int> userValues, int upperThreshold) {
for (int i = 0; i < userValues.size(); ++i) {
if(userValues.at(i) < upperThreshold) {
cout << userValues.at(i) << " ";
}
}
cout << endl;
}
int main() {
vector<int> userValues;
int upperThreshold;
int numValues;
cin >> numValues;
userValues = GetUserValues(userValues, numValues);
cin >> upperThreshold;
OutputIntsLessThanOrEqualToThreshold(userValues, upperThreshold);
return 0;
}
Explanation:
Perhaps their is a better way to code this, but I couldn't figure out what to do with the pointer in the first function.
Answer: Conditional statements are just true false statements
Explanation:
Let's say there's a kpop band burglarizing my house and I have a super AI that detects if a kpop band is my house through cameras. What it would do is change a variable "kpopBandInHouse = False" to True. I would then have an if statement next with a custom function:
if kpopBandInHouse == True:
nukeHouse()
So if the conditional statement is true, it nukes my house. It is false, it does not nuke my house.