I've taught some C++ to my nephew because he wanted to participate in the Olympiad in Informatics, the local stage.
In terms of languages I don't like, C++ is in a league of its own. E.g., the pointers, and the weird constructs, such as usage of “streams” for reading/writing file handles.
To read/write files, I told my nephew to simply mimic examples. To declare arrays, I advised him to just declare large ones, instead of bothering w/ pointers and dynamic allocation 🤷♂️
@alexelcu Interesting, streams are certainly cumbersome in some situations, but the one thing they have going for them is that they are very natural.
Why do you consider them weird?
@simontoth When learning programming, there can be a gap b/w understanding things and being able to do useful stuff. The larger that gap is, the more the language sucks for beginners.
Streams in C++ are OOP constructs. But more than OOP, they work based on ad-hoc polymorphism to infer an encoder/decoder from the variable used. Some types work, many don't, a guessing game for beginners. Furthermore, the operators (<<, >>) are hard to learn, versus English words (e.g., read/write/print).
No, you write an statement that reads in each item on the line.
int I;
string s;
cin >> I >> s;