您如何从班级打印整数

发布于 2025-02-05 04:26:59 字数 1771 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南街九尾狐 2025-02-12 04:26:59

您应该使用-werror编译。这将您的警告变成了错误。当您这样做时,您会看到以下错误:

prog.cpp:25:43:警告:多字符角色常数[-wmultichar]
void printcords(){std :: cout<< x<< ','<< y<< '\ n'; }
^~~~~

应该向您表明有问题。如果将其更改为字符串文字:

void PrintCords() { std::cout << x << " , " << y << '\n'; }
                                 ---> ^   ^

,一切都可以。

You should compile with -Werror. This turns your warnings into errors. When you do this, you will see the following error:

prog.cpp:25:43: warning: multi-character character constant [-Wmultichar]
void PrintCords() { std::cout << x << ' , ' << y << '\n'; }
^~~~~

Which should indicate to you that something is wrong. If you change this to a string literal:

void PrintCords() { std::cout << x << " , " << y << '\n'; }
                                 ---> ^   ^

Then everything will be ok.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文