Answer:
See the code in the Eplanation
Explanation:
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int firstNumber;
int secondNumber;
int thirdNumber;
cout<< "Enter the firstNumber: ";
cin >> firstNumber;
cout << "Enter the secondNumer: ";
cin >> secondNumber;
cout << "Enter the thirdNumber: ";
cin >> thirdNumber;
int upperbound= abs(firstNumber-secondNumber);
int lowerbound= abs(secondNumber-thirdNumber);
if (lowerbound==upperbound){
cout << "The Three Numbers are Equally spaced";
}
else{
cout << "The Three Numbers are NOT Equally spaced";
}
}
Answer:
A HashMap< String, Agent >
is a best collection for this
Explanation:
Collection is basically a framework that is used in order to perform operations on data and to store and manipulate objects.
HashMap is a Map based collection where Map is a data structure of interface which allows the key and value pairs mapping and HashMap is a collection class used to store these key-value pairs of data.
The syntax is:
HashMap<key, value>
So in HashMap< String, Agent > statement the String is used to store the codename for every agent and Agent is an object that represents each agent. So this is represented as key-value pair using HashMap.
Answer:
Check the explanation
Explanation:
Here the data type we are making use of is int. Now when this function is being called for finding factorial of 13 or numbers that are greater than 13 then the function is expected to shows error and the desired result will not be produced.
Reason for this problem is-- range of int dat type is -2,147,483,648 to 2,147,483,647 . Now factorial of 12 is 47,90,01,600 which is less than 2,147,483,647 . But factorial of 13 is 6,22,70,20,800 which is greater than 2,147,483,647 which means int data type can not hold such large variable. That’s why it will not give desired result for value of n greater than 12.
Now you might just want to ask that what will function do in that case – the afct ins that different languages do different things in case of overflows. Some languages just say that data type can not handle . take for instance, when it comes to java warning about overflow is not there. And during overflow there it will show negative numbers.