1. what is a statement ?give an example pls.
2. what is a function? "
3. what is a expression? "
P.S. I already know what variables are, but these three makes confuses me. Im interested in the real concept of these,examples would also help.
1. what is a statement ?give an example pls.
2. what is a function? "
3. what is a expression? "
P.S. I already know what variables are, but these three makes confuses me. Im interested in the real concept of these,examples would also help.
o.k., but first tell me what you think they mean.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
And if you need some hints, think about what they mean in everyday language (and in the case of functions, what does it mean in math?)
This seems to be a recurring theme today.Originally Posted by sean_mackrory
Quzah.
Hope is the first step on the road to disappointment.
Quzah, I'm disappointed in you. You should know by now that people not thinking for themselves is a recurring theme everyday. It also seems like every day that someone takes your advice as an invitation to remove themselves from the human gene pool. Though it's not a bad idea for some of them.
sorry never mind.
This program exits when "x" is greater than 5:
"int x" is a declaration. Things like the "for", "break", etc are statements. Expressions are more mathematical, like "x > 5" or "x = 0". A function is a self-contained block of code which can be called as needed, and can return a result if desired. In this program "main()" and "test()" are functions.Code:int main() { int x; for(x = 0; x < 10; x++) if(test(x)) break; } int test(int x) { if(x > 5) return 1; else return 0; }
P.S. why say anything at all if you aren't going to answer the dude's question?
> 1. what is a statement ?
A piece of code that performs an action.
> 2. what is a function? "
A named collection of statements.
> 3. what is a expression? "
A bunch of operators and operands that do stuff.
My best code is written with the delete key.
> 3. what is a expression? "
All these are expressions
<runs and hides>
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
As Frank Barone says, the bathroom is the only room the house where a man can truly express himself. I'd be happy to share some of my expressions with you.
Thanks to those who answered. I ask these seemingly easy questions basically because Im really having a hard time understanding them.Of course I have my own understanding of these things but it helps to compare to people who really know what theyre talking about.