test

 

contents add author 插入图片试试

1707830759399

使用```插入代码

int a = 3;
string b = "test”;
char func(string c) {
// do something
}
a = 2
b = 3
def fun():{
    a = a + b
    return a
}

使用 hightlight

int a = 3;
string b = "test”;
char func(string c) {
// do something
}
Let’s see some code!
print('Hello World!')

//test

  • C++ is a statically typed language, statically typed: everything with a name (variables, functions, etc) is given a type before runtime.
# Python(Dynamic) VS C++(Static)
a = 3
b = "test”
def func(c):
// do something

int a = 3;
string b = "test;
char func(string c) {
// do something
}
 def div_3(x):
 	return x / 3
 div_3("hello")
 //CRASH during runtime, can’t divide a string

 int div_3(int x){
 	return x / 3;
 }
 div_3("hello")
 //Compile error: this code will never run
  • std::pair< >
std::pair<int, string> numSuffix = {1,"st"};
cout << numSuffix.first << numSuffix.second;

// To avoid specifying the types of a pair, use std::make_pair(field1, field2)
std::make_pair(false, 2);
  • auto: auto does not mean that the variable doesn’t have a type. It means that the type is deduced by the compiler.

Streams

Success Text.

Info Text.

Warning Text.

Error Text.

I am an error

The body of the error box goes here. Premonition allows you to write any Markdown inside the block.

I am a warning

The body of the warning box goes here. Premonition allows you to write any Markdown inside the block.