c++ - cout 在 switch 语句中不起作用
问题描述
再会,
我有一个循环计算值并将输出显示到控制台。但是,当我运行代码时,cout <<
不会显示我预期的输出。事实上,它不显示任何输出。我知道代码甚至可以工作的唯一方法是值正在发生变化。
cout <<
在我使用 switch 语句之前工作得很好。我希望在语句和循环中打印到控制台的每一段文本都是死文本。它没有用。我还尝试使用cout.flush
. 那也不起作用,我不能包含我的所有代码,但这里有问题:
if (exampleloop == '1'){
ExampleValue = (ExampleValue - 1);
ExampleValue = (ExampleValue - ExampleValue);
cout << "ExampleText " << ExampleValue << " ExampleText";
if (ExampleValue <= 0){
cout << "ExampleText.";
}
if (ExampleValue <= 0){
cout << ExampleText";
}
example_label:
ExampleValue = (ExampleValue1 - ExampleValue1);
cout << "ExampleText! " << ExampleValue! << " ExampleText!";
goto Example_label;
}
我知道正在计算代码的唯一方法
cout << "EXAMPLE TEXT ExampleValue1 at "<< ExampleValue <<" . ExampleText";
在这种情况下,“示例文本”将永远不会出现在控制台上。但是,将计算“示例值”,并且更改将反映在上面的代码中。
我的 IDE 是 repl.it
这是我的错,还是我的 IDE 的错?发生了什么事?
(是的,我#include iostream
和我是using namespace std
)
解决方案
推荐阅读
- sql-server - 存储过程 - 截断表
- oracle - 错误 PLS-00428:此 SELECT 语句中应有一个 INTO 子句
- python - 了解树遍历中的递归
- javascript - AWS Chime 开发工具包 | CreateUser 功能不起作用
- android - 不推荐使用 getLine1Number 获取设备标识符
- c - 即使我关闭了所有内容,某些管道文件描述符仍保持打开状态
- python - sqlite-problem-sqlite3-operationalerror-near-where-syntax-error
- google-sheets - Google 表格输出上的 googletranslate()
- javascript - Javascript:存储全局变量,以便以后可以重定向用户
- angular - 重载子组件路由重载父父组件