Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

Write a c++ program that can take either two integers or two floating point numbers and outputs the smallest and greatest number using class,function



#include <iostream>
using namespace std;

int smallest(int a, int b)
return (a<b) ? a:b;

float smallest(float a, float b)
return (a<b) ? a: b;

int main()
return 0;
1 3 1
Mark me as brainiest if u find it more useful
Also use class, that will be nice as question asks for implementation of class and function overloading

This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
#include <iostream.h>
 class Smaller {
  int smaller(int x, int y)
   return x < y ? x : y;
   float smaller(float x, float y)
    return x < y ? x : y;
void main()
  int x = 45;
  int y = 17;
   cout << Smaller().smaller(x, y) << endl;
   float p = 7.443f; float q = 11.11111f; cout << Smaller().smaller(p, q) << endl;
0 0 0
are you a regular programmer ??
check out my code, once... if u are answering, must answer the exact thing, questioner asking....
and there are rules for syntax and other thing, u must follow those rules
I've attached the code, check it out.....
0 0 0
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts