If you borrow code from some source, it is probably best to cite it (like adapted from [source]). However, if you take let's say you borrowed this function (example in C++):void doWork(){     cout << Doing work!\n << endl;}and now you editted it to be like this:void doWork(){     string name = ;     cout << Starting work...\n << endl;     cout << Hello user. What is your name? << endl;     cin >> name;     ...}Would you still have to say adapted from [source] or something like that? Or are you in the safe zone?Note: I am specifically wondering how this applies to copyrighted (and open source) code
Citing Borrowed Code
copyright
If you are taking code from copyrighted or open source code, then you must conform by the licensing terms under which you obtained the code. If you do not have such a licensing agreement, then you are in violation of copyright law regardless of whether you cite the code or not.In the case of GPL, in order to use the snippet of code, you must also release ALL of your code under the GPL and include the GPL license as part of your distributed product. You do not need to cite which part you borrowed.Commercial code typically does not require any form of acknowledgement, licensing or citation.Other open source licenses may vary in requirements, but as far as I know none require you to cite the individual parts of the code.