如何解决搜索链接到 cout 的变量的名称!像一个:cout c++
当我在互联网上通过源代码搜索新信息时,
我看到有人将 goto
用于一个变量,而这个变量与一个 cout
语句,与 std::cout
中的相同。
他写了a:cout
。
你能帮我找到这个函数的名字吗?
void Main_Menu() {
int i;
cout << "\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\t HOSPITAL MANAGEMENT SYstem \n\n";
cout << "\n\n\t\t\t\t\t\tPlease,Choose from the following Options: \n\n";
cout << "\t\t\t\t\t\t _________________________________________________________________ \n";
cout << "\t\t\t\t\t\t| |\n";
cout << "\t\t\t\t\t\t| 1 >> Add New Patient Record |\n";
cout << "\t\t\t\t\t\t| 2 >> Add Diagnosis information |\n";
cout << "\t\t\t\t\t\t| 3 >> Full History of the Patient |\n";
cout << "\t\t\t\t\t\t| 4 >> information About the Hospital |\n";
cout << "\t\t\t\t\t\t| 5 >> Exit the Program |\n";
cout << "\t\t\t\t\t\t|_________________________________________________________________|\n\n";
a: cout << "\t\t\t\t\t\tEnter your choice: ";
cin >> i;
if (i > 5 || i < 1) {
cout << "\n\n\t\t\t\t\t\tInvalid Choice\n";
cout << "\t\t\t\t\t\tTry again...........\n\n";
goto a;
} //if inputed choice is other than given choice
解决方法
没有变量 a
链接到 cout
。 a:
是一个标签,您可以使用 goto a;
跳转到该标签。代码也可以这样写
a:
cout << "\t\t\t\t\t\tEnter your choice: ";
cin >> i;
if (i > 5 || i < 1) {
cout << "\n\n\t\t\t\t\t\tInvalid Choice\n";
cout << "\t\t\t\t\t\tTry again...........\n\n";
goto a;
} //if inputed choice is other than given choice
有趣的旁注:为什么
void f()
{
http://stackoverflow.com
https://stackoverflow.com
}
有效的 C?因为 http
和 https
被视为标签,而 //
开始评论。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。