|
From: Per W. <pw...@ia...> - 2008-03-28 14:36:36
|
No, your code was not working fine two days ago. It was only you who did
incorrect testing of your code, and assumed that it was working!
Exactly what do you think this line mean:
if(a|b|c == char())
Note that | is a bit operator.
And what do you think char() does?
/pwm
On Thu, 27 Mar 2008, sam Ruma wrote:
> This code was working fine two days ago. But today it is acting weird. It runs fine but the result is wrong. It is suppose to give me a message whenever I enter character instead of number.
> =====================================================
> #include<iostream>
> #include<cctype>
> using namespace std;
> int main()
> { int a,b,c;
> cout << "Enter 3 integers a,b,c \n";
> cin >> a>>b>>c;
> cout <<"\n";
> if(a|b|c == char())
>
> {
> cout <<"Please don't enter characters. Enter numbers only.\n";
> }
> else
> { if(a!=b && b!=c)
> cout << "Scalene\n";
> else if (a==b && a!=c)
> cout <<"Isosceles\n";
> else if (a==b && a==c)
> cout <<"Equilateral\n";
>
> }
> system("pause");
> return 0;
>
> }
> ========================================================
>
>
> ---------------------------------
> Never miss a thing. Make Yahoo your homepage.
|