Which of the following is the correct basic structure for a C++ program?

  • #include
    using namespace std;
    void main() { }
  • #include
    int main() { cout << "Hello"; }
  • #include
    using namespace std;
    int main() { return 0; }
  • import
    int main() { }
The standard structure for a C++ program begins with the inclusion of the iostream header, followed by the "using namespace std;" directive. The entry point of a C++ program is the "main()" function, and it should return an integer. The correct structure uses #include (without .h) and returns a value (typically 0) from the main function.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *