Why doesn't a simple “Hello World”-style program compile with Turbo C++?

前端 未结 3 1237
面向向阳花
面向向阳花 2020-11-22 11:29

I have started learning C++ for my programming class. I have downloaded this \"Hello World\" program:

#include 
using namespace std;

int mai         


        
3条回答
  •  臣服心动
    2020-11-22 12:08

    Turbo C++ is a very old compiler and it is a little bit different from the GNU C++ compiler. The code you shared will work perfectly with the GNU compiler but to run it with Turbo C++ you need to make a few changes:

    1. Change the name of header file from iostream to iostream.h
    2. And remove the line "using namespace std" It is not required in Turbo C++. Here is the modified code:

    #include 
    
    int main() 
    {
      cout << "Hello, World!";
      return 0;
    }
    

提交回复
热议问题