whats the error of this program c++

0 votes
asked Jan 29 by mohamed
#include<iostream.h>
int main ()
{ int x=-3;
int y=6;
if(x<0 && y=2)
x=40;
cout<<x<<"   "<<y<<endl;
return 0;
}

5 Answers

+1 vote
answered Jan 29 by (560 points)
 
Best answer

#include<iostream.h>
int main ()
{ int x=-3;
int y=6;
if(x<0 && y==2)//here was  the prblm you forgot to give two equal to( y==2)

x=40;
cout<<x<<"   "<<y<<endl;
return 0;
}

commented Jan 30 by (110 points)
yea that is what you have to or translate the code to linux runit on linux and debug it on linux and translate it back to its original form and should be fine :  |
+1 vote
answered Feb 2 by anonymous

#include<iostream.h>
int main ()
{ int x=-3;
int y=6;
if(x<0 && y==2) //it should be written like this because you are comparing value of y//
x=40;
cout<<x<<"   "<<y<<endl;
return 0;
}

+1 vote
answered Feb 3 by (160 points)

#include<iostream.h>
int main ()
{ int x=-3;
int y=6;
if(x<0 && y==2)//comparision so we use double equal
x=40;
cout<<x<<"   "<<y<<endl;
return 0;
}

0 votes
answered Nov 23 by anonymous

#include<iostream.h>
int main ()
{

 int x=-3;
int y=6;
if(x<0 && y==2)
x=40;
cout<<x<<"   "<<y<<endl;
return 0;

}

0 votes
answered Nov 30 by anonymous
#include<iostream.h>
int main()
{
int x=-3;
int y=6;
if(x<0&&y=2)
x=40;
cout<<x<<"  "<<y<<endl;
return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...