前导课程: 高等数学是由微积分学,较深入的代数学、几何学以及它们之间的交叉内容所形成的一门基础学科。
主要内容包括:数列、极限、微积分、空间解析几何与线性代数、级数、常微分方程。
// professional C++, 4th Edition P6
#include “namespace.h”
/* // pragma 解决头文件包含的问题
#pragma once // pragma 打错了progma
namespace mycode{
void foo();
}
*/
#include
#include // for std::byte == unsigned char
using namespace mycode;
// why not using “using namespace std;”
//Just remember that you are part of a team, so make sure you use an approach that //is consistent with the rest of your organization.
namespace a{
namespace b{
namespace c{
int x = 2;
}
}
}
int main(){
mycode::foo(); // Calls the “foo” function in 个the “mycode” namespace
//foo(); // implies mycode::foo();
int uninitializedInt;
int initializedInt = 7;
std::cout << uninitializedInt << " is a random value " << std::endl;
std::cout << initializedInt << " was assigned a inital value " << std::endl;
std::cout << a:🅱️:c::x << std::endl;
int y = 23’456’789;
std::cout << "y = " << y << std::endl;
float z = 0.23’456’7f;
std::cout << "z = " << z << std::endl;
signed k = 0x3.ABCp-10;
std::cout <<"k = " << k << std::endl;
auto n = 0Xb.cp121;
std::cout << "n = " << n << std::endl;
std::byte b1{0x3F};//0011 1111
std::byte b2{0b1111’0000};
std::byte b4[4] {b1, b2, std::byte{1}}; // 4 bytes (last is 0)
if (b1 == b4[0]) //0x3F == 0011 1111
{
b1 <<= 1; // <<= 1 => 0111 1110 = 126
}
std::cout << std::to_integer<int>(b1) << '\n'; // outputs: \T{126}
printf("what the f**k is it???????/");
/*
也就是说当你打 ??/ 的时候会被转为 \ ,
而转为这个 \ 以后会发生什么事情呢? 那就是转义了? !
新的语法, 有新的解析
*/
return 0;
}
namespace mycode{
void foo(){
std::cout << "foo() called in the mycode namespace " << std::endl;
}
}
wannian07@wannian07-PC:~$ g++ -std=c++17 -o c17 c17.cpp -pthread
wannian07@wannian07-PC:~$ ./c17
foo() called in the mycode namespace
0 is a random value
7 was assigned a inital value
2
y = 23456789
z = 0.234567
k = 0
n = 3.12369e+37
126
what the f**k is it???/