diff --git a/.gitignore b/.gitignore index 7a042f5..c9a224c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,88 +1,94 @@ -# ---> C++ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -# ---> C -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - +# ---> C++ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# ---> C +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# 自定义 +*/output +*.i +*.s +*.o +*.swp \ No newline at end of file diff --git a/day4/d2.cpp b/day4/d2.cpp new file mode 100644 index 0000000..058e619 --- /dev/null +++ b/day4/d2.cpp @@ -0,0 +1,13 @@ +#include // 用于使用bitset +#include + +using namespace std; + +int main() +{ + cout << "12 = " << 12 << endl; // 结果:12 + cout << "ob01001 = " << bitset<5>(0b01001) << endl; // 结果:9, bitset<8>用于2进制形式输出 + cout << "062 = " << 062 << endl; // 结果: 50 + cout << "062 = " << oct << 062 << endl; // 结果: 50, oct 用于8进制形式输出 + cout << "0x4f = " << hex << 0x4f << endl; // 结果: 79,hex 用于16进制形式输出 +} diff --git a/day4/exercise_2.4.1.cpp b/day4/exercise_2.4.1.cpp new file mode 100644 index 0000000..c2d9af1 --- /dev/null +++ b/day4/exercise_2.4.1.cpp @@ -0,0 +1,13 @@ +#include // 用于使用bitset +#include + +using namespace std; + +int main() +{ + int x; + x = 52; + cout << "52 的二进制:" << bitset<8>(x) << endl; // bitset<8>用于2进制形式输出, 8表示8位 + cout << "52 的八进制:" << oct << x << endl; // oct 用于8进制形式输出 + cout << "52 的十六进制:" << hex << x << endl; // hex 用于16进制形式输出 +} diff --git a/day4/hello.cpp b/day4/hello.cpp new file mode 100644 index 0000000..2cf3a0f --- /dev/null +++ b/day4/hello.cpp @@ -0,0 +1,21 @@ +/* ************************************************************************ + * Filename: hello.cpp + * Description: + * Version: 1.0 + * Created: 2023年06月14日 17时37分18秒 + * Revision: none + * Compiler: gcc + * Author: YOUR NAME (liubo), + * Company: + * ************************************************************************/ + +#include + +using namespace std; + +int main(int argc, char **argv) +{ + // 你好,c++ + cout << "hi, c++" << endl; + return 0; +}