Check out example codes for "life the universe and everything solution c++". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>

int main()
{
    int input ;
    while( std::cin >> input && input != 42 ) std::cout << '\t' << input << '\n' ;
    while( std::cin >> input ) ;
}

Learn ReactJs, React Native from akashmittal.com