Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
#include <iostream>
using namespace std;
int main()
{
		int evennumber;
		int oddnumber;
		int sum=0;
		int number=5;
		int x=2;
		int y=1;
		int z=(x*x)+2*(x*y)-(x/y);	
	{
		cout<<"After evaluation of given expression the value of z is:"<<z;
 cin="">>z;
		cout<<"The last digit of my vu id is:"<<number;
 cin="">>number;
		cout<<"The sum is:"<<sum;
 cin="">>(sum=z+number);
	}
}
{if (sum=evennumber)


What I have tried:

I searched for the result on youtube and also on this site but I can't find anything suitable
Posted
Updated 19-May-21 22:40pm
v2

C++
{if (sum=evennumber)
This code is outside any function, and can;t be executed as a result.
If you wanted it in the main function, then it needs to be above the close curly bracket on the line above, but even if it is, it needs a statement to execute if the condition is true or it won't compile. You probably don't need the open curly bracket that line starts with, either.
It also needs the assignment changing to an equality test: "=" is an assignment, "==" is an logical operator.

Your main function will also need a return statement, since it is defined as returning a value.

In addition the curly brackets here are redundant:
C++
   {
       cout<<"After evaluation of given expression the value of z is:"<<z;
cin="">>z;
       cout<<"The last digit of my vu id is:"<<number;
cin="">>number;
       cout<<"The sum is:"<<sum;
cin="">>(sum=z+number);
   }

And you can't read a value into a calculation:
cin="">>(sum=z+number);
, nor does cin need an assignment in any line of that code!
 
Share this answer
 
Comments
Richard MacCutchan 20-May-21 7:27am    
I remember now, the editor puts those ="" in for some odd reason. I think it is strange tab characters in the original.
OriginalGriff 20-May-21 7:54am    
Ah ... could be!
Richard MacCutchan 20-May-21 8:04am    
I've raised it in Bugs'n'Sugs.
You have not completed the code, and much of it is wrong, you are printing values before you have captured them. The statement:
C++
if (sum=evennumber) // means set sum to the value of evennumber
// it should be
if (sum == evennumber) // double = signs for comparison
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900