C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - Programs (Q.No. 1)
1.
What will be the output of the following program?
#include<iostream.h> 
class IndiaBix
{
    int x; 
    public:
    IndiaBix(int xx, float yy)
    {
        cout<< char(yy);
    } 
}; 
int main()
{
    IndiaBix *p = new IndiaBix(35, 99.50f);
    return 0; 
}
99
ASCII value of 99
Garbage value
99.50
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
10 comments Page 1 of 1.

Chandu reddy said:   6 years ago
Please, can anyone explain deeply? How it converts and why need to convert?

Madhubala said:   8 years ago
Please explain properly.

Alka said:   8 years ago
Yes, it should print C. Whose ASCII value is 99.

Aniruddha said:   8 years ago
99 is the ASCII value. Printing char(99) would print the character whose ASCII value is 99 i.e. 'c'.

Aditya Singh said:   9 years ago
The f denotes 99.50 is a float value.

Iram zakir said:   9 years ago
What about this 99.50f, what is f?

Is it just misprinting?

Velmurugan said:   1 decade ago
How float is convert into char(int)? Because arithmetic operation float is convert into integer. (i.e) 55.4 is convert into 55.

Nilofer said:   1 decade ago
How float is converted into char(int)?

Rudraksh said:   1 decade ago
Kindly elaborate how float is converted into char(int)?

Anonymous said:   1 decade ago
float is converted to int and char(int) gives the ASCII value of 99

Post your comments here:

Your comments will be displayed after verification.