Answer:
The code to this question can be given as:
code:
tp = ip;
ip = jp;
jp = tp;
Explanation:
In this question, it is defined that write code for swapping values that swap the pointers, not the values they point to. So in this code, we assume that all the variable and its value is defined. we simply use the swapping rule that is the first value holds in the new variable and second value hold on the first variable and in the last second variable holds the value of the new variable. In this code, the value will be interchanged or swapped.
Answer:
Following are the program to this question:
#include <iostream>//defining header file
using namespace std;
int recurs(int x, int n)//defining a method recurs that accepts two parameter
{
if(n==0)//defining if block that checks n value
{
return 1;//return value 1
}
else//defining else block
{
return x*recurs(x,n-1);//use return keyword that retun value
}
}
int main()//defining main method
{
cout<<recurs(5,3); //use print method to call recurs method
return 0;
}
Output:
125
Explanation:
In the above-given program, the integer method "recurs" is declared which accepts, two integer variables, which are "x, n", inside the method the if conditional statement is used.
- In the if block, it checks the value of n is equal to "0" if this condition is true, it will return a value, that is 1.
- Otherwise, it will go to the else block, in this block, it will use the recursive method to print its value.
He created computer mouse
What's the question your asking here cause I'd be happy to answer it.
Answer:
Option (A) int expressions are always computed exactly; but float expressions can suffer round-off error.
Explanation:
Round - Off Error can be defined as the digital computers have limitations on denoting the decimal numbers, due to this the floating point numbers have to be rounded off or even it is represented exactly after the calculation on the numbers the resulting number has to be adjusted / rounded off according to the specified precision. The resulted number has to be rounded off back to the required precision, this leads to the round off errors in digital computers. As integers don't need to go through the rounding off in computers, the integer numbers don't have round off errors, only floating point numbers have round off errors. So, options (B) , (C) and (D) are false.