Infosys interview question

Just asked some basic stuff in C++. Asked to write a program in C++.