Zend certified PHP/Magento developer

Validate Simple Input and Output of a program on terminal

I do competitive programming so I need to check certain output for certain input. For which what I do is I compile my program with g++ file.cpp and than I paste input values in a new file called in.txt . And I simply get output for this input by this command ./a.out < in.txt.
Problem is each time I need to paste input in input file and perform all this. And after doing so when I get output I need to match it with correct output manually. I want something if possible like I just run ./a.out after this I paste 2 thing input and second is output . If programs output matches with given output than it should print OK with output otherwise it should print Check Again.

What I want is I dont want to paste sample input in in.txt file what I want is simply paste on terminal and it should accept and give me verdict.