我正在尝试使用 Ubuntu Linux 在 Visual Studio Code 中配置 C/C++ 工作区,但我不知道如何使调试器正常工作。我从互联网上复制了一个“tasks.json”文件,以便能够通过按下 F5 来编译我的代码,但我认为它会导致调试器出现某种问题,因为每次我尝试进入调试模式时,都会出现错误“Could没有找到任务“gcc build active file”弹出。这是2个jsons:tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "debug",
"type": "shell",
"command": "",
"args": [
"g++",
"-g",
"${relativeFile}",
"-o",
"a.exe"
]
},
{
"label": "Compile and run",
"type": "shell",
"command": "",
"args": [
"g++",
"-g",
"${relativeFile}",
"-o",
"${fileBasenameNoExtension}.out",
"&&",
"clear",
"&&",
"./${fileBasenameNoExtension}.out"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": …
Run Code Online (Sandbox Code Playgroud) 所以,对于我的考试,我必须评估一些C++表达式.这是表达式:
float x=3<<2>>1?4.:.5?6:7>8;
Run Code Online (Sandbox Code Playgroud)
有人可以用文字解释它,因为我无法理解它.所以,我必须将3转换为二进制并将其移位2位.但转换后结果为11.我可能会添加位符号,因此它变为011.并且在位符号之后我可以添加尽可能多的0,因此3 << 2-> 01100.但之后我不能了解一个事情.条件运算符的条件在哪里?:因为我看不到任何东西?谢谢你的建议,帮我解决这个问题:)