Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

whats the error of this program c++

+1 vote
asked Jan 29, 2019 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, 2019 by metal gamer (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, 2019 by Default302 (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, 2019 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, 2019 by Pavithra Ravichandran (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, 2019 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, 2019 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.
...