Is there any (reasonably) straightforward way to generate comments to explain the structure of a C++ program? For example I’d like to take this code as input:
int main(){
cout << "Hello World!";
return 0;
}
and produce this as output:
int main(){
//create a function called main that returns an integer and takes no parameters.
cout << "Hello World!";
//print the string "Hello World" to the standard output.
return 0;
//the function main returns 0
}
If it were possible to do this, it might make (the syntax of any C++ program) slightly less daunting for beginners.
If this can’t be done for C++ (with existing tools), are (any similar tools) available for other programming languages?
There is
cdecltool (and on-line version at http://cdecl.org/) to explain declarations. Take a look.