Answer:
#include <stdlib.h>
#include <time.h>
#include<iostream.h>
int main(void) {
int seedVal = 0;
seedVal = 4;
srand(seedVal);
/* Solution*/
cout<<rand() % 149 + 100<<endl;
cout<<rand() % 149 + 100<<endl;
return 0;
}
Explanation:
We start with the required include statements to enable use of srand, rand and time functions. I have also added iostream library to use "cout" function.
After that, the seed is initialized using srand(). And then the two rand functions are called with ranges including and between 100 and 149, and printed out.
Answer:
The method definition to this question can be given as:
Method definition:
public void clear(int[] arr, int num) //define method clear.
{
if (num == 0) //if block
{
return 0; return value.
}
else //else block
{
arr[num - 1] = 0; //assign value in arr.
return arr[]; //return value.
}
}
clear(arr, num - 1); //calling
Explanation:
The description of the above method definition as follows:
- Firstly we define a method that is "clear" that does not return any value because its return type is "void". This method accepts two integer variables that are "arr[] and num" where arr[] is an array variable and num is an integer variable.
- Inside a method, we use a conditional statement in if block we check that num variable value is equal to 0. if this condition is true so, it will return 0 otherwise it will go to else block in else block it will assign value in variable arr[num-1] that is "0" and return arr value.
Answer:
#include <iostream>
using namespace std;
void CoordTransform(int *ptr1, int *ptr2);
int main()
{
int xVal;
int yVal;
cout<<"please enter two valid integers";
cin>>xVal;
cin>>yVal;
CoordTransform(&xVal , &yVal);
int xValNew=xVal;
int yValNew=yVal;
cout<<xValNew<<yValNew;
return 0;
}
void CoordTransform(int *ptr1, int *ptr2)
{
int a = *ptr1;
*ptr1=(*ptr1+1)*2;
*ptr2=(*ptr2+1)*2;
}
Explanation:
It will return new values in previously defined variables
coding language: c++
Answer:
1. Using meaningful names for all variables and functions.
2. Use shorter blocks of codes wherever possible
Explanation:
Their code should be easy to read, this can be achieved by avoiding complex syntax, basically they should adopt the two methods stated in the answer
Answer:
I'd go with the 2nd one
If it heats up more & more, then it's lifespan will be shortened more & more. The more it heats up, the less durability it has.