Can anyone tell whats wrong in below code?

I m learning c++ ..so maybe this ll be very easy solution for you guys

Hello i m learning c++ ..so maybe this ll be very easy solution for you guys

#include<iostream.>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
cout<<"Enter Your 1st Value";
cin>>a;
cout<<"Enter Your 2nd value";
cin>>b;
cout<<"Enter your 3rd value";
cin>>c;

              if(a>b&&c)
                {
                    cout<<"1st value is greater";
                }
                           else if(b>a&&c)
                                {
                                          cout<<"2nd value is greater";
                                }
              else if(c>b&&a)
                     {
                           cout<<"3rd value is greater";
                     }

getch();
}

Recommended Answers

All 3 Replies

replacements:

int main()
{
using namespace std;
int a,b,c;
//Take out clrscr(); from this line, hope this works

This isn't a code snippet. If possible, please change the thread type to a regular old thread as opposed to a code snippet.

The && operator doesn't work that way. You want something like this:

if (a > b && a > c)
   cout << "First value is the max.";
commented: your code worked...thx for helping +0

@VernonDozier

Thanks for helping me...your code works

@bobbytommathew
thanks for your tips

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.