#include <hash_map>
#include <list>
#include <set>
#include <bitset>
#include <string>
using namespace std;
Using the freopen function you can read/write from a file, like you are reading from the standard input/output. freeopen first tries to close any file already associated with the stream given as third parameter and disassociates it.
A person smokes cigarettes and leaves the lower portion (around 1/5) of it unburnt. He then combines the 5 residues of those cigarettes to create a new one for smoking.
If the person had initially 93 cigarettes, how many cigarettes did he actually smoked?
He will smoke 116 cigarettes.
Sample code to explain some advanced STL concepts.
The urban legend goes that if you go to the Google homepage and search for "Google", the universe will implode. We have a secret to share... It is true! Please don't try it, or tell anyone. All right, maybe not. We are just kidding. The same is not true for a universe far far away. In that universe, if you search on any search engine for that search engine's name, the universe does implode! To combat this, people came up with an interesting solution. All queries are pooled together. They are passed to a central system that decides which query goes to which search engine.
A train line has two stations on it, A and B. Trains can take trips from A to B or from B to A multiple times during a day. When a train arrives at B from A (or arrives at A from B), it needs a certain amount of time before it is ready to take the return journey - this is the turnaround time. For example, if a train arrives at
12:00 and the turnaround time is 0 minutes, it can leave immediately, at 12:00.
The crude way of deleting the items in a vector is:
warning: deprecated conversion from string constant to ‘char*’