xyz
is a function with two arguments. The first argument of the function has the type int
. The second argument has the type double
. The function returns a value of the type double
. Which of the following blocks of code is correct?
double z; double y; int x;
std::cin >> y >> x >> z;
z=xyz(x,y);
double z; double y; int x;
std::cin >> y >> z >> x;
double=xyz(int,double);
double z; double y; int x;
std::cin >> z >> x >> y;
double=xyz(int x,double y);
double z; double y; int x;
std::cin >> z >> x >> z;
double z=xyz(y,x);
double z; double y; int x;
std::cin >> z >> x >> z;
(y,x)=xyz(double z);
modifySequence
is:
int modifySequence(int * aA){ if( (*aA) == 26 ){ *aA=(*aA)*2; } else{ *aA=(*aA)*10; } return *(aA+50)+(*aA+50); }Assume that
aX
contains the address of the first term of the sequence of integers. The elements of the sequence are \(1\), \(6\), \(11\), \(16\), \(\dots\). Every two consecutive terms differ by \(5\) and there are \(1000\) terms in the sequence. What is the content of the variable total
after the following block of code?
int total; total=modifySequence(aX+5)+modifySequence(aX+15); total+=aX[5]+aX[15];
Example: Input: 7 35.9 51.7 21.5 33.2 37.5 35.7 40.5 Output: 30.2Explanation: The temperature on day 0 is \(t_0=35.9\). The temperature on day 1 is \(t_1=51.7\). The temperature on day 2 is \(t_2=21.5\), and so on. The days \(1\) and \(2\) are consecutive. The difference between the temperatures \(t_1\) and \(t_2\) is \(|t_2-t_1|=30.2\) and this is the maximal of all of the differences on consecutive days.
Warning: Do not implement the codes from this problem on a standard computer. A damage can occur.
The implementation of the function spider
is given below.
long spider(long x, long y, long z){ if(x < 75){ return y*75+z; } if(y > 70000){ return spider(x-1,8,z); } if(z > 30000){ return spider(x,y+89,59); } return spider(x,y,z+19); }What is the content of the variable
crawl
after the following code is executed on a computer with sufficiently fast CPU and sufficiently big memory?
long crawl; crawl=spider(50000,28,23);
The user input consists of three integers \(a\), \(b\), and \(c\). Make a program that creates a sequence \(y\) of \(a+b+c\) terms for which both of the following two conditions hold:
If there is no such sequence \(y\), then the program should print the message
The sequence y does not exist.
Example 1: Input: 1 50 1 Output: Sequence y does not exist. Example 2: Input: 3 5 4 Output: 2 3 2 3 2 1 2 1 2 3 1 3