How can I write an Operating System in C or C++This is very vague, and I believe that you will discover that it will take a
looooonnnng time to have something functional.
First start to learn about the chipset used in computer you wish to run on.
You will need to create your own drivers, like keyboard, harddisk/floppy
monitor as a first step. Step 2 learn to create a Floppy/harddisk bootstrap.
You have no other choice to create this in assembler since you have only 256
bytes to start up the rest on a floppy drive. I do not know about the
harddisk.
Next create your file system.
And now you are ready to begin your OS.
You cannot use any MFC or windows functionality in C++, you must create a
complete stripped C++ program to do that. But it is possible. Avoid .NET.
And make a converter that converts the executable to the binary format you
need for you OS.
Good luck.
PS it is possible, but it takes a hell of a time to do it.