c++ - Strange syntax flaw in mingw -
at line 23- cout<"" doesnt give error instead removing statement produces abnormal output. have tried in codeblocks using mingw32. when remove gives- process returned 1984687287 (0x764df487)
#include<iostream> #include<stdio.h> using namespace std; int ispalin(long num) { long sum=0,n; short rem; n=num; while(n>0) { rem=n%10; sum=sum*10+rem; n/=10; } if(sum==num)return 1; return 0; } int main() { int n=1; for(int i=999;i>=1;i--) { for(int j=999;j>=1;j--) { if((i*j)<=n) { cout<""; // line 23 break; } if((i*i)<=n) { printf("%d",n); return 0; } if(ispalin(i*j)) { n=i*j; cout<<n<<"\n"; break; } } } return 1; }
it doesn't give error because it's legal, albeit fruitless, statement. ostream
objects implicitly convertible void*
. expression results in comparison between void*
, const char*
, legal.
as error when remove statement, cannot reproduce it.
Comments
Post a Comment