C++ Programming - Functions - Discussion
Discussion Forum : Functions - Programs (Q.No. 10)
10.
What will be the output of the following program?
#include<iostream.h>
class IndiabixSample
{
public:
int a;
float b;
void BixFunction(int a, float b, float c = 100.0f)
{
cout<< a % 20 + c * --b;
}
};
int main()
{ IndiabixSample objBix;
objBix.BixFunction(20, 2.000000f, 5.0f);
return 0;
}
Discussion:
7 comments Page 1 of 1.
Naresh said:
4 years ago
@Princy.
% ---> is a modular operator it gives you reminder value as output.
/ ---> is a divisor operator it gives your quotient value as output.
EX:
6%2= 0;
6/2 = 3;
% ---> is a modular operator it gives you reminder value as output.
/ ---> is a divisor operator it gives your quotient value as output.
EX:
6%2= 0;
6/2 = 3;
(1)
Nishchith said:
5 years ago
Why you are not taking c=100.0 values ?
(1)
Masthan said:
6 years ago
how it possible?
c++ will allow to deciment the float values.
--2.0,
= 1.0.
c++ will allow to deciment the float values.
--2.0,
= 1.0.
Prince said:
8 years ago
It's a % operator which gives rem that's why it gives 0. @Princy.
Princy said:
8 years ago
20%20=1.
But in this problem you consider 20%20=0 is this correct? I don't know?
But in this problem you consider 20%20=0 is this correct? I don't know?
Ajay said:
8 years ago
Is it possible to solve int and float data types together in an equation and what is the outcome at the final stage?
Karthick said:
1 decade ago
a=20,b=2.000000f,c=5.0f
cout<< 20%20 + 5.0 * --2.0
0 + 5.0 * --2.0
0 + 5.0 * 1.0
cout<< 5
cout<< 20%20 + 5.0 * --2.0
0 + 5.0 * --2.0
0 + 5.0 * 1.0
cout<< 5
(8)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers