python与c++的第一个hello world程序区别在于,c++直接用‘ cout<< ’或者printf(" 字符串%s ",字符串变量名)进行输出,而python则是用print(" 字符串 ",字符串变量名)进行输出。
c++示例如下:
```
#include <iostream>
using namespace std;
#include "string" //当使用cout输出字符时需要包含string库
void main()
{
string name = "gentleman";
//--------cout法------
cout << "name is:%s\n" << name << endl;
//--------printf法----
printf("name is:%s\n", name);
}
python示例如下:
```
print("hello world")
name = "gentleman" #python中不需要定义变量类型,因为python是动态解释语言,
print("name is :", name)
```