Answer:
#include <iostream>
#include <map>
using namespace std;
int main()
{
map<int, int> numbers;
cout << "Enter numbers, 0 to finish" << endl;
int number;
while (true) {
cin >> number;
if (number == 0) break;
numbers[number]++;
}
for (pair<int, int> element : numbers) {
std::cout << element.first << ": occurs " << element.second << " times" << std::endl;
}
}
Explanation:
One trick used here is not to keep track of the numbers themselves (since that is not a requirement), but start counting their occurrances right away. An STL map< > is a more suitable construct than a vector< >.
Answer:
In C++:
int PrintInBinary(int num){
if (num == 0)
return 0;
else
return (num % 2 + 10 * PrintInBinary(num / 2));
}
Explanation:
This defines the PrintInBinary function
int PrintInBinary(int num){
This returns 0 is num is 0 or num has been reduced to 0
<em> if (num == 0) </em>
<em> return 0; </em>
If otherwise, see below for further explanation
<em> else
</em>
<em> return (num % 2 + 10 * PrintInBinary(num / 2));
</em>
}
----------------------------------------------------------------------------------------
num % 2 + 10 * PrintInBinary(num / 2)
The above can be split into:
num % 2 and + 10 * PrintInBinary(num / 2)
Assume num is 35.
num % 2 = 1
10 * PrintInBinary(num / 2) => 10 * PrintInBinary(17)
17 will be passed to the function (recursively).
This process will continue until num is 0
Answer:
i am still a beginner in this but i hope it helps.
- add scanner object;
- declare string FavColour;
- print msg to ask user for input
- print msg (" your favourite colour is " + FavColour)
Answer:
No
Explanation:
Virtual and physical metrics have to be collected and analysed to look for allocation problems such as: VM sprawl, too many VMs, or improperly provisioned VMs are occurring.
Answer:
Social Engineering Attack
Explanation:
The exploitation of individuals in order to gain confedential information is a Social Engineering Attack. These attacks typically take advanage of one's emotions or they use inpersonaltion to steal data.
read more here: https://www.webroot.com/us/en/resources/tips-articles/what-is-social-engineering
Lmk if this helps! :)