Answer:
Answer is in the attached screenshot.
Explanation:
Using regex to split a given input string via whitespace, then returns the first and last element of the array.
Answer:
Following are the code to this question:
CarCounter::~CarCounter()//Defining destructor CarCounter
{
cout << "Destroying CarCounter\n";//print message Destroying CarCounter
}
Explanation:
Following are the full program to this question:
#include <iostream>//Defining header file
using namespace std;
class CarCounter //Defining class CarCounter
{
public:
CarCounter();//Defining constructor CarCounter
~CarCounter();//Defining destructor CarCounter
private:
int carCount;//Defining integer variable carCount
};
CarCounter::CarCounter()//declaring constructor
{
carCount = 0;//assign value in carCount variable
return;//using return keyword
}
CarCounter::~CarCounter()//Defining destructor CarCounter
{
cout << "Destroying CarCounter\n";//print message Destroying CarCounter
}
int main() //Defining main method
{
CarCounter* parkingLot = new CarCounter();//Defining class object parkingLot
delete parkingLot;//
return 0;
}
- In the given C++ language code, a class "CarCounter" is defined, and inside the class, a "constructor, Destructors, and an integer variable" is defined.
- Outside the class, the scope resolution operator is used to define the constructor and assign value "0" in the integer variable.
- In the above-given code, the scope resolution operator, to define destructor and inside this cout function is used, which prints a message.
- In the main method, the class object is created, which automatically calls its class constructor and destructors.
Solution:
In the game Singularity, broken objects can be restored to their original condition by reversing time. This is an example of which time element of player adjustment.
Thus the required answer is player adjusted.
Answer:
The C# code is given below
Explanation:
using System;
public class SwimmingWaterTemperatur
{
public static void Main()
{
while(true){
Console.Write("\nPlease enter the water temperature : ");
int x = Int32.Parse (Console.ReadLine());
try{
if(CheckComfort(x)){
Console.Write(x+" degrees is comfortable for swimming.");
}else{
Console.Write(x+" degrees is not comfortable for swimming.");
}
}catch(Exception ex){
Console.WriteLine(ex);
}
}
}
public static Boolean CheckComfort(int temp){
if(temp>=70 && temp<=85){
return true;
}else if(temp>=32 && temp<=212){
return false;
}else{
throw new ArgumentException("Value does not fall within the exptected range.");
}
}
}