Jan 16, 2011 at 3:49pm UTC
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<"enter 1st number";
cin>>a;
cout<<"enter 2nd number";
cin>>b;
cout<<"enter third number";
cin>>c;
clrscr();
if(a>b)
{
if(a>c)
cout<<"the biggest number is:- "<<a;
else
cout<<"the biggest number is:- "<<c;
}
else
{
if(b>c)
cout<<"the biggest number is:- "<<b;
else
cout<<"the biggest number is:- "<<c;
}
getch();
}
Jan 16, 2011 at 4:00pm UTC
Is there a question in there or are you storing code?
Jan 16, 2011 at 4:01pm UTC
#include <iostream>
using namespace std;
int main ()
{
int a,b,c;
cout<<"Enter the first number: ";
cin>>a;
cout<<"Enter the second number: ";
cin>>b;
cout<<"Enter the third number: ";
cin>>c;
if (a>b && a>c) && (b>c) { cout<<a<<b<<c; }
if (a>b && a>c) && (c>b) { cout<<a<<c<<b; }
if (b>a && b>c) && (a>c) { cout<<b<<a<<c; }
if (b>a && b>c) && (c>a) { cout<<b<<c<<a; }
if (c>a && c>b) && (a>b) {cout<<c<<a<<b; }
if (c>a && c>b) && (b>a) { cout<<c<<b<<a; }
cin.get (); cin.get() ;
return 0;
}
Last edited on Jan 16, 2011 at 4:03pm UTC
Jan 16, 2011 at 6:45pm UTC
I've tried this before, so you do not have to worry about is not running.
Hope this helpful
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include <iostream>
#include <string>
using namespace std;
//FUNCTION
void intswap(int &a, int &b)
{
int temp;
temp = a;
a = b;
b = temp;
}
int main()
{
int counter;
int input1;
int input2;
int input3;
char question[2];
while (true ){
counter = 0;
cout << "" << ++counter <<". Please Enter the first number : " ;
cin >> input1;
cin.sync(); //clear buffer
cout << "" << ++counter <<". Please Enter the second number : " ;
cin >> input2;
cin.sync();
cout << "" << ++counter <<". Please Enter the third number : " ;
cin >> input3;
cin.sync();
if (input1 < input2)
intswap(input1, input2);
if (input1 < input3)
intswap(input1, input3);
else
{
if (input1 < input3)
intswap(input1, input3);
}
cout << "The largest number is " << input1 <<"" <<endl<<endl;
cout << "Try again ? [y/n] : " ;
cin >> question;
cout << endl;
if (!strcmpi("n" , question))
break ;
}
cin.get();
return 0;
}
Last edited on Jan 16, 2011 at 6:52pm UTC