“de4310e67dc8acc30ef179c57087919de6069af4”上不存在“...device/gpu/git@gitcode.net:paddlepaddle/Paddle.git”
提交 472c1acb 编写于 作者: F feilong

添加include指令

上级 34cde60f
// 标题: 定义一个 C语言的头文件
// 描述: 头文件可以被其他文件代码通过 #include "xxx.h"
// 导入,下面哪个选项的头文件的实现正确。
#ifndef CALC_H
#define CALC_H
int calc(char op, int x, int y) {
switch (op) {
case '+':
return x + y;
case '-':
return x - y;
case '*':
return x * y;
case '/':
return x / y;
default:
return 0;
}
}
#endif
\ No newline at end of file
{
"type": "code_options",
"author": "幻灰龙",
"source": "calc.h",
"multiline":[
{
"#ifndef CALC_H": "",
"#define CALC_H": "",
"#endif": ""
},
{
"#define CALC_H": ""
},
{
"#ifndef CALC_H": ""
}
]
}
\ No newline at end of file
// 标题: 简易四则运算
// 描述: 假设"calc.h"和本文件在同一个目录下,计算 (1+2)*(2-1)/2
#include "calc.h"
#include <stdio.h>
int main(int argc, char **args) {
printf("%d", calc('/', calc('*', calc('+', 1, 2), calc('-', 2, 1)), 2));
return 0;
}
\ No newline at end of file
{
"type": "code_options",
"author": "幻灰龙",
"source": "calc_test.c",
"multiline":[
{
"#include \"calc.h\"":"#include <calc.h>"
},
{
"#include \"calc.h\"":"using \"calc.h\""
},
{
"#include \"calc.h\"":"#include(\"calc.h\")"
}
]
}
\ No newline at end of file
......@@ -6,5 +6,8 @@
"C语言"
],
"children": [],
"export": []
"export": [
"calc.json",
"calc_test.json"
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册