From 428eaec33c32a5b86b68b55ba79fcf81266d50f5 Mon Sep 17 00:00:00 2001 From: flykhan Date: Mon, 19 Jun 2023 15:23:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E4=BD=8D=E5=8F=96=E5=8F=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day6/d7.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 day6/d7.cpp diff --git a/day6/d7.cpp b/day6/d7.cpp new file mode 100644 index 0000000..4abc219 --- /dev/null +++ b/day6/d7.cpp @@ -0,0 +1,13 @@ +#include + +using namespace std; + +int main() +{ + int n = 10; + cout << "~10 = " << ~n << endl; // -11 : ~ 位非运算符: 二进制取反: 0000 1010 => 1111 0101 => -11 + n = -9; + cout << "~(-9) = " << ~n << endl; // 8 : ~ 位非运算符: 二进制取反: 1000 1001 => 0111 0110 => 8 + + return 0; +} \ No newline at end of file