Modules in C++ programs are

functions
procedures
subroutines
miniprograms

The correct answer is: A. functions

A module is a self-contained unit of code that can be reused in multiple programs. It is a collection of functions, variables, and constants that are grouped together and have a common purpose. Modules are defined using the #include directive.

A function is a block of code that performs a specific task. It is defined using the function keyword. A function can be called from another function or from the main program.

A procedure is a similar to a function, but it does not return a value. It is defined using the procedure keyword.

A subroutine is a synonym for a function.

A miniprogram is a small program that can be used as part of a larger program. It is defined using the miniprogram keyword.

Here is an example of a module in C++:

“`c++

include

using namespace std;

// This is a module.
module myModule {
// This is a function in the module.
void myFunction() {
cout << “Hello, world!” << endl;
}
}

int main() {
// Call the function in the module.
myModule::myFunction();

return 0;
}
“`

This program will print the following output:

Hello, world!

Exit mobile version