bash how to delete ^M at the end of every line

C++
# Basic syntax:
dos2unix input_file
Source

Also in C++: