Clion IDE 注释了我的第二部分代码。我能做些什么?
您好,我正在为有限自动机编写一些代码,但这并不重要。
当我尝试在 CLion 中编写代码时,我对代码的第二部分进行了注释(来自第 32 行 case JEDNORADKOVA)。您知道如何修复我的 CLion 或者问题出在哪里吗?
我的代码:
#include <stdio.h>
typedef enum {START ,POSSIBLE_COMMENT, SINGLE_LINECOMMENT, MULTILINECOMMENT,MULTILINECOMMENT_MAYBE_END, QUOTATION_MARKS} tStates;
int main() {
tStates state = START;
printf("Delete of comments. Enter input \n");
int sighn ;
while((sighn=getchar()) != EOF)
{
switch (state) {
case START:
if (sighn == '/') {
state = POSSIBLE_COMMENT; }
else{
putchar(sighn);
}
case SINGLE_LINECOMMENT:
if (sighn == '\n')
state= START;
case MULTILINECOMMENT:
if (sighn == '*')
break;
case MULTILINECOMMENT_MAYBE_END:
case QUOTATION_MARKS:
break;
}
}
return 0;
}
。 png" alt="我在 CLion 中的代码">
我在 VS Code 中的代码
Hi I am writing some code for finite automata but that is not important.
When I try to write in CLion my second part of the code is commented (from line 32 case JEDNORADKOVA). Do you know how can I repair my CLion or where is problem then?
My code:
#include <stdio.h>
typedef enum {START ,POSSIBLE_COMMENT, SINGLE_LINECOMMENT, MULTILINECOMMENT,MULTILINECOMMENT_MAYBE_END, QUOTATION_MARKS} tStates;
int main() {
tStates state = START;
printf("Delete of comments. Enter input \n");
int sighn ;
while((sighn=getchar()) != EOF)
{
switch (state) {
case START:
if (sighn == '/') {
state = POSSIBLE_COMMENT; }
else{
putchar(sighn);
}
case SINGLE_LINECOMMENT:
if (sighn == '\n')
state= START;
case MULTILINECOMMENT:
if (sighn == '*')
break;
case MULTILINECOMMENT_MAYBE_END:
case QUOTATION_MARKS:
break;
}
}
return 0;
}
MY code in CLion
My code in VS Code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
阅读 CLion 中的消息:“无法访问的代码:32”,错误已清除。
我已经格式化了你的源代码,但它似乎不是你在 CLion 中的源代码。由于缩进和支撑很混乱,我认为您的右支撑太多了。
Read the messages in CLion: "Unreachable code :32" and the error is clear.
I have formatted your source, but it seems to be not the one you have in CLion. Since the indenting and bracing are chaotic, I assume that you have a closing brace too much.
关于:
无论
znak
中的值如何,这都会打印一两个“/”字符,然后将下一个“switch”选择器设置为START
可能不是您想要的,因为它导致接下来的几个case
永远不会被执行regarding:
regardless of the value in
znak
, this will print one or two '/' characters then set the next 'switch' selector toSTART
probably not what you want as it results in the next couple ofcases
never being executed