Answer:
- #include <iostream>
- using namespace std;
- class myinteger {
-
- private:
- int value;
-
- public:
- myinteger(int x){
- value = x;
- }
-
- int getValue(){
- return value;
- }
-
- };
- int main()
- {
- myinteger obj(4);
- cout<< obj.getValue();
- return 0;
- }
Explanation:
Firstly, we use class keyword to create a class named myinteger (Line 5). Define a private scope data field named value in integer type (Line 7 - 8).
Next, we proceed to define a constructor (Line 11 - 13) and a getter method for value (Line 15 -17) in public scope. The constructor will accept one input x and set it to data field, x. The getter method will return the data field x whenever it is called.
We test our class by creating an object from the class (Line 23) by passing a number of 4 as argument. And when we use the object to call the getValue method, 4 will be printed as output.
Answer:
This is really hard. I tried doing this problem but of was a real pain. I honestly can't help. I tried. sorry mate.
<u>Answer:</u>
- <em>A. divide the decimal number by the base value 2</em>
- <em>C. note the remainder separately</em>
- <em>D. divide by 2 until she gets 0 as the remainder</em>
- <em>B. collect the digits in the reverse order</em>
<u>Explanation:</u>
When we want to convert decimal number to a binary number first we have divide the given number by 2. The next step is to note the reminder of the number in the side every division so that the reminder value is the binary value. Repeat this until an zero is encountered.
We have to collate all the remainders from last of first and then the collated number is the answer for the given problem.
<em>So the given option can be ordered as,
</em>
- <em>A</em>
- <em>C</em>
- <em>D</em>
- <em>B</em>
Answer:
in computer booting is the process of starting a computer it can be initiated By hardware such as button press or by a software command after it is switched on a computer central processing unit ( CPU)