slecting the largest no.

hi! i've just entered the world of c++....
i got a problem plz help me to solve!
i'e
Last edited on
And what have you done so far?
not much ! but does not work
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>

int main()
{
     int nums[3] = {0} ;

     std::cout << "Give me three numbers!\n"

     std::cin >> nums[0] >> nums[1] >> nums[2] ;

     unsigned size_of_0 = sizeof(nums[0]) ;
     unsigned size_of_1 = sizeof(nums[1]) ;
     unsigned size_of_2 = sizeof(nums[2]) ;

      if ( size_of_0 == size_of_1 && size_of_0 == size_of_2)
                std::cout << "They're all the same size, genius!\n" ;
      if ( size_of_0 > size_of_1 && size_of_0 > size_of_2 )
                std::cout <<  nums[0]  << " is the largest of them all!\n" ;
      if ( size_of_1 > size_of_0 && size_of_1 > size_of_2 )
                std::cout << nums[1] << " is the largest of them all!\n" ;
      if ( size_of_2 > size_of_0 && size_of_2 > size_of_1 )
                std::cout << nums[2] << " is the largets of them all!\n" ;
}
but it gives ou
Last edited on
@cire dude!
Last edited on
Lmao, this made me laugh. Good one.
Topic archived. No new replies allowed.