For instance take example of a program which calculates the time you take to type a paragraph and displays the time you took ( at the end ). Here our program is simultaneously performing two tasks :
 1.Waiting for user to type ( taking input ).
 2.A clock behind counts the time elapsed .

How can I accomplish both the tasks during execution ( at the same time ) . 
 [ OK ! You may think of subtracting final & initial time which we may get by system but I want multitask to take place .] 

I tried a lot searching for standard library functions but none of them do it .
I think the only way to make multitask happen is smart algorithm of the program which does many tasks simultaneously as well as efficiently . Am I wrong ?