0

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();
}

Edited by th3learner: n/a

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by th3learner
0

replacements:

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

1

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.";
Votes + Comments
your code worked...thx for helping
0

@VernonDozier

Thanks for helping me...your code works

@bobbytommathew
thanks for your tips

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.