MESSAGE
DATE | 2011-06-02 |
FROM | Ruben Safir
|
SUBJECT | Re: [NYLXS - HANGOUT] C++ Workshop
|
Eh I just took an examination for a Bloomberg job, and I'll tell you, I'm so frustrated with myself. The examine didn't cover anything particularly advanced, but it hammered on a bunch of stuff that are like puzzles needing sure knowledge of operator precedence, and type casting. The C++ end had a lot of questions on "virtual", something I'm just not familiar with yet, const and static values.
I felt like such an idiot.
Ruben
On 05/31/2011 08:41 PM, Ruben Safir wrote: > 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; > } >
|
|