- Nov 8, 2010
- 4,422
- 23
- 81
I am taking intro class on C++ programming, but I am completely stuck to solve this problem.
Variable declarations are:
char ch = 'E';
int humidity = 21;
int speed = 4;
long rain = 6;
double temperature = 25;
So,
Humidity + Speed will result in "int" and a result value of 25.
Humidity + Temperature will result in "double" and a resulting value of 46.
Temperature + (int) Speed will result in "double" and a resulting value of 29.
(int) Temperature + Speed will result in "int" and a resulting value of 29.
Humidity % Rain will result in double and value of .5
Am I correct about the answers above?
Lastly, I am completely unable to figure out:
ch + speed
(char)(ch + speed) What are resulting type and value?
I appreciate your help in advance.
Variable declarations are:
char ch = 'E';
int humidity = 21;
int speed = 4;
long rain = 6;
double temperature = 25;
So,
Humidity + Speed will result in "int" and a result value of 25.
Humidity + Temperature will result in "double" and a resulting value of 46.
Temperature + (int) Speed will result in "double" and a resulting value of 29.
(int) Temperature + Speed will result in "int" and a resulting value of 29.
Humidity % Rain will result in double and value of .5
Am I correct about the answers above?
Lastly, I am completely unable to figure out:
ch + speed
(char)(ch + speed) What are resulting type and value?
I appreciate your help in advance.
