Whenever you copy code from others, you have to cite the source ! For details, please go to: MIT Code Writing Handbook.
What should be provided
- URL
- Date of retrieval
- ( If you adapted the code ) Add “Adapted from..” or “Based on..”
- ( If you use open source software ) Copyright ( in your code ) + License ( in your workspace folder )
Format of citing code sources
Example 1——Qt comment format ( No copyright )
1
2
3
4
5
6
7
8
9
/**
* A utility class.
* Adapted from [xxxx, source name] on [YYYYMMDD, date of retrieval]
* Source: [URL]
* [..., Other introduction]
*/
class Util{
// Insert your code here...
}
Example 2 ( No copyright )
1
2
3
// Adapted from [xxxx, source name]:
// [URL, where you find it]
// (Source: [URL, source code] retrieved in [YYYY MM DD]
Example 3 ( Open source software )
1
2
3
// Copyright (c) YYYY ........
// ....
// (You can just copy the copyright from git)