Write a program to read two numbers from the keyboard and display the larger value on the screen
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
float a,b;
cout<<" Enter two values :"<<endl;
cin>>a>>b;
if(a>b)
cout<<" larger value = "<<a<<endl;
else
cout<<" larger value = "<<b<<endl;
return 0;
}
OUTPUT:
Enter two values:10 20
Larger value:20
| Is This Answer Correct ? | 2 Yes | 0 No |
How does stack look in function calls? Write a recursive function call, how will the stack look like?
Briefly explain various access specifiers in C++.
What is a virtual function in C++?
What is the difference between realloc() and free() in C++?
C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.
What are the advantages/disadvantages of using #define?
Write a C++ program to print strings in reverse order.
Explain what happens when an exception is thrown in C++.
How to invoke a C function using a C++ program?
Consider the following C++ program
Can we provide one default constructor for our class?
Can we call a virtual function from a constructor?