21xrx.com
2024-04-27 12:01:16 Saturday
登录
文章检索 我的文章 写文章
C++你好世界程序
2021-07-08 15:04:22 深夜i     --     --
C + +

你好! 您是否正在寻找如何编写 C++ hello world 程序? 我希望我能帮到你。

你好世界 C++ 程序

#include <iostream> // Declaration of header


using namespace std; // Using std namespace

int main() // Function main through which program execution begins
{
  cout << "Hello World"; // Displaying "hello world"

  return 0; // Returning 0 indicates success to the operating system
}

使用类的 C++ hello world 程序

#include<iostream>


using namespace std;

// Creating class

class Message
{
  public:

    void display() {
      cout << "Hello World";
    }
};

int main()
{
    Message t;    // Creating an object
    t.display();  // Calling function

    return 0;
}

 

  
  

评论区

{{item['qq_nickname']}}
()
回复
回复
    相似文章