I have a code like this:
int main()
{
    int x=0;
    std::cout<<"Enter numbers"<<std::endl;
    while(std::cin>>x)
    {
        std::cout<<"Number entered: "<<x<<std::endl;
    }
    return 0;
}
When I press ctrl+c code gets terminated. I would like to print something like 'program terminated because ctrl+c was pressed. I know exception handling is a way. But is there any other alternative? By the way, I am running on linux.
 
     
     
    