Is C++ a suitable language for coding for machines and robots?

If not any other language? I don't want to make games just robots like flying drones and that stuff is c++ good for thi as I wouldn't want to waste my time.

Yes. As an example, one of the more popular controllers for hobbyist robotics is the Arduino, and it uses a custom "Arduino Language" that's a dialect of C/C++. If you already know C or C++, you can be productive almost immediately. If you are doing a project "from scratch", you can generally pick any language you like, but you might find it hard to avoid assembly language for parts of your project. It's interesting to read "just robots like flying drones". If "just" means you think of this arena as something less demanding than game code, think again. Among other things, you can restart a game if things go wrong. You can't uncrash a drone. Or, if you meant "just" and in "only" or "nothing else", you might need a detour or two. Real-time control programming of any sort is necessarily complicated. Classes, books and tutorials usually start in a very simple application environment (the old-fashioned terminal or console) and add complexity gradually.