C++ use if else

Please refrain from using namespace std;

{  int a,b,c,d;
   int w=0.0,x=0.0,y=0.0,z=0.0;
   std::cout<<"enter four numbers" << std::endl;
   std::cin>>a>>b>>c>>d;
int max = a;
   if (b > a)
max = b;
if ( c > max)
max = c;
if (d > max)
max = d;
  std::cout << max << std::endl;
}

I voluntarily kept trivial code that seems abordable for you and have left you space to now determine max2, max3 and max4.

Leave a Comment