Managed code is a code whose execution is managed by Common Language Runtime. It gets the managed code and compiles it into machine code. After that, the code is executed.
The runtime here i.e. CLR provides automatic memory management, type safety, etc.
Managed code is written in high-level languages run on top of .NET. This can be C#, F#, etc. A code compiled in any of this language with their compilers, a machine code is not generated. However, you will get the Intermediate Language code, compiled and executed by runtime.
C/C++ code, called "unmanaged code” do not have that privilege. The program is in binary that is loaded by the operating system into the memory. Rest, the programmer has to take care of.
C++ can also produce unmanaged binaries that run on Windows.
C# allows unmanaged constructs like pointers directly in code using unsafe context. It sets a piece of code for which the execution is not managed by the CLR.