MESSAGE
DATE | 2011-05-31 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] C++ Workshop
|
OK -
I phave a puzzle for the workshop.
explain this code and it's output
#include #include
int main(int argv, char ** argc){
char x = 'm'; float a = 3.14, b = 9.3453, e = 3, f = 1/3; f = (1.0 / 3); short c = 6; std::cerr.write( "x = ", 4); std::cerr.put(x); std::cerr.put( '\n'); std::cerr << "x = " << x << std::endl; std::cout << "a + b + c = " << std::scientific << a + b + c << " hello World" << std::endl; std::cout << "a + b + c = " << std::fixed << a + b + c << std::endl; std::cout << "e * f = " << e << " * " << f << "=" << e * f << std::endl; ((std::cout.write("x= ", 3)).operator<<(x)).operator<<(std::endl); ((std::cout.operator<<("x= ")).operator<<(x)).operator<<(std::endl); std::cout << "x = " << x << std::endl; }
|
|