- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的代码。我不确定为什么会出现这些错误,并且我尽可能地仔细查看了。
我知道第一个错误似乎发生是因为我的“loopend:”标签
在我的程序结束时似乎距离太远了。那是可能的原因吗?
至于其余的,我不知道为什么会 pop 。
在“if(Choice ==“OSI”)区域之后,这似乎是一个问题。
#include "stdlib.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;
int main() {
ifstream pswdchk ("OSIUser.setting");
string Password[5];
string Passload[5];
string NormPass;
string tocmd;
int Chickenvar=0;
int CMD=1;
string Choice;
string Title;
string style = "-";
string Bdr = "";
string Columnten = "";
string Columnten1 = "";
string Columnten2 = "";
string WaitColumn = "";
std::string opt1;
std::string opt2;
std::string opt3;
std::string opt4;
std::string opt5;
std::string opt6;
loop:
system("color 3b");
if(CMD==0) {
cout <<"Invalid Command.\n\n>";
}
if (Chickenvar==1) {
cout << "\n\nChicken 'style' to chicken a stylish chicken test. Chicken 'exit' to chicken\nprogram. KFC is love, KFC is life.\n\nCHICKEN GOES HERE>";
}
if (CMD==1) {
if (Chickenvar==0) {
cout <<"OBCLS Version 0.3\nType exit to quit.\n\n>";
}
}
CMD=0;
cin >>Choice;
if(Choice=="exit") {
goto loopend;
}
if(Choice=="style") {
using namespace std; //It seems I need it here too?
CMD=1;
system("color 2e");
system("CLS");
opt1 = "\n1: Style 1";
opt2 = "\n2: Style 2";
opt3 = "\n3: Style 3";
opt4 = "\n4: Style 4";
opt5 = "\n5: Style 5";
opt6 = "\n6: No Style";
std::cout << "Hello!" << "\nThis is a test of the OIS Styling System..." << "\nChoose a style:" << opt1 << opt2 << opt3 << opt4 << opt5 << opt6 <<"\n";
std::string Choice = "";
ChoiceRetry:
cout << "\n>";
cin >> Choice;
if (Choice == "6") {
cout << "Viewing styleless window:\n\n";
goto ChoiceYes;
}
cout << "\n\n";
if (Choice == "1") {
Columnten = "----------";
Columnten1 = " ----------";
Columnten2 = "---------";
Bdr = "| ";
WaitColumn = " ---------PRESS--ENTER--------";
style = "1";
goto ChoiceYes;
}
if (Choice == "2") {
Columnten = " ";
Columnten1 = "o ";
Columnten2 = " o";
Bdr = " ";
WaitColumn = "o PRESS ENTER o";
style = "2";
goto ChoiceYes;
}
if (Choice == "3") {
Columnten = "//////////";
Columnten1 = "//////////";
Columnten2 = "//////////";
Bdr = "/";
WaitColumn = "/////////PRESS ENTER/////////";
style = "3";
goto ChoiceYes;
}
if (Choice == "4") {
Columnten = "==========";
Columnten1 = "==========";
Columnten2 = "==========";
Bdr = "=";
WaitColumn = "=========PRESS==ENTER=========";
style = "4";
goto ChoiceYes;
}
if (Choice == "5") {
Columnten = "##########";
Columnten1 = " #########";
Columnten2 = "######### ";
Bdr = "#";
WaitColumn = " ####### PRESS ENTER ####### ";
style = "5";
goto ChoiceYes;
}
cout << "Invalid input.";
goto ChoiceRetry;
ChoiceYes:
Title = " EXAMPLE: ";
//string ColumnTitle = Columnten1, Title, Columnten2;(USE COUT)
//string Column = Columnten1, Columnten, Columnten2; (USE COUT)
cout << Columnten1<< Title<< Columnten2 << "\n" ;
string TYPE = "This is an example window ";
cout << Bdr<< TYPE<< Bdr<< "\n";
TYPE = " for style ";
cout << Bdr<< TYPE<< style ;
TYPE = ". ";
cout << TYPE<<Bdr<< "\n";
cout << WaitColumn;
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
system("CLS");
}
if (Choice=="Chicken"){
if(Chickenvar==0){
Chickenvar=1;
cout<<"Chicken Mode Enabled";
goto Chicken_toggle_end;
}
if(Chickenvar==1){
Chickenvar=0;
goto Chicken_toggle_end;
cout<<"Chicken Mode Disabled";
}
Chicken_toggle_end:
CMD=1;
goto loop;
}
if (Choice=="cmd"){
system("CLS");
system("color 6e");
cout <<"This will not work on systems with a disabled command prompt\n\n";
system("cmd");
CMD=1;
system("CLS");
}
if (Choice=="help"){
CMD=1;
cout<<"To run commands using CMD, type 'cmd'.\nTo test the styling system, type 'style'.\nTo exit the program, type 'exit'.\nTo run the GUI, type 'OSI'.\n\n";
}
if (Choice=="OSI"){
Styleloop:
system("CLS");
system("color 2a");
cout<<"\n\nChoose the system style.\nEnter 1-5, 6 for no style:";
cin>>Choice;
if (Choice == "1") {
Columnten = "----------";
Columnten1 = " ----------";
Columnten2 = "---------";
Bdr = "| ";
WaitColumn = "- - - - - - - - - - - - - - - - - - - - - - - - - ";
style = "1";
goto Styleend;
}
if (Choice == "2") {
Columnten = " ";
Columnten1 = "o ";
Columnten2 = " o";
Bdr = " ";
WaitColumn = "o o";
style = "2";
goto Styleend;
}
if (Choice == "3") {
Columnten = "//////////";
Columnten1 = "//////////";
Columnten2 = "//////////";
Bdr = "/";
WaitColumn = "////////////////// ++++ ////////////////";
style = "3";
goto Styleend;
}
if (Choice == "4") {
Columnten = "==========";
Columnten1 = "==========";
Columnten2 = "==========";
Bdr = "=";
WaitColumn = "================================================";
style = "4";
goto Styleend;
}
if (Choice == "5") {
Columnten = "##########";
Columnten1 = " #########";
Columnten2 = "######### ";
Bdr = "#";
WaitColumn = " ############################################## ";
style = "5";
goto Styleend;
}
if (Choice == "6") {
string style = "-";
string Bdr = " ";
string Columnten = " ";
string Columnten1 = " ";
string Columnten2 = " ";
string WaitColumn = " ";
goto Styleend;
}
goto Styleloop;
Styleend:
OSImainloop:
system("CLS");
opt1 = " ";
opt2 = " OSI v0.2.3 ";
opt3 = " ";
opt4 = " 1: Exit ";
opt5 = " 2: Log in ";
opt6 = " ";
Title=" Welcome to OSI GUI v1.0 ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nEnter A Number:";
cin>>Choice;
if(Choice=="1"){
goto exitmain;
}
if (Choice=="2"){
goto OSImainloopbreak;
}
goto OSImainloop;
OSImainloopbreak:
OSIlogloop:
system("CLS");
opt1 = " Type exit to go back ";
opt2 = " ";
opt3 = " ";
opt4 = " - ENTER PASSWORD - ";
opt5 = " Type 'new' to create a new user. ";
opt6 = " ";
Title=" User Login Access System ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nEnter Password:";
cin >>Choice;
if (Choice=="exit"){
goto OSImainloop;
}
if (Choice=="new"){
newuser:
system("CLS;");
opt1 = " Type exit to abort operation ";
opt2 = " ";
opt3 = " Please enter a password ";
opt4 = " for your new user. ";
opt5 = " ..... ";
opt6 = " ";
Title=" User Login Access System ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nEnter Your New Password:";
cin >>NormPass;
if (NormPass=="new"){
system("CLS;");
opt1 = " ";
opt2 = " Sorry. This password is reserved ";
opt3 = " for the new user command. ";
opt4 = " ";
opt5 = " -Press Enter- ";
opt6 = " ";
Title=" -Error- ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\n";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
goto newuser;
}
if (NormPass=="exit"){
goto OSImainloopbreak;
}
PassGenRetry:
ofstream passgen;
passgen.open ("OSIUser.setting");
if (passgen.is_open()) {
passgen <<NormPass;
}
else {
filebadloop:
system("CLS;");
opt1 = " ";
opt2 = " The file 'Users.passwf' did ";
opt3 = " not open successfully. ";
opt4 = " A new user cannot be created. ";
opt5 = " 1=Retry 2=Abort ";
opt6 = " ";
Title=" User Login Access System ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nEnter A Number:";
cin>>Choice;
if (Choice=="1"){
cout<<"Press Enter to attempt to open 'Users.passwf' again...";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
goto PassGenRetry;
}
if (Choice=="2"){
goto OSImainloopbreak;
}
goto filebadloop;
}
system("CLS;");
opt1 = " ";
opt2 = " Password has been successsfully installed. ";
opt3 = " Press Enter to continue. ";
opt4 = " ";
opt5 = " ..... ";
opt6 = " ";
Title=" User Login Access System ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\n";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
goto OSIlogloop;
}
Pswdchkloop:
if (pswdchk.is_open()){
for(int i = 0; i < 5; ++i){
pswdchk>>Password[i];
}
}
else {
chkbadloop:
system("CLS;");
opt1 = " ";
opt2 = " The file 'Users.passwf' did ";
opt3 = " not open successfully. ";
opt4 = " Passwords failed to load. ";
opt5 = " 1=Retry 2=Abort ";
opt6 = " ";
Title=" User Login Access System ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nEnter A Number:";
cin>>Choice;
if (Choice=="1"){
cout<<"Press Enter to attempt to open 'Users.passwf' again...";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
goto Pswdchkloop;
}
if (Choice=="2"){
goto OSImainloop;
}
goto chkbadloop;
}
if (Choice==Password[0]){
goto OSIlogloopbreak;
}
goto OSIlogloop;
OSIlogloopbreak:
if (Chickenvar==1){
cout<<"ADMIN ENABLED\n\nPress Enter";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
}
else {
cout<<"User initiated.\n\nPress Enter";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
}
loopmainmenu:
system("color 3b");
system("CLS;");
if (Chickenvar==1){
opt1 = " Welcome Admin v0.2.3 ";
}
else {
opt1 = " Welcome User v0.2.3 ";
}
opt2 = " Options: ";
opt3 = "-Programs ";
opt4 = "-Options ";
opt5 = "-About ";
opt6 = "-Exit ";
Title=" - Welcome - ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nChoose an option:";
cin>>Choice;
for(unsigned int n = 0; n < Choice.length(); ++n) {
Choice[n] = tolower(Choice[n]);
}
if (Choice=="exit"){
goto OSImainloop;
}
if (Choice=="about"){
system("CLS;");
system("color 7e");
opt1 = " OSI GUI and Command Shell ";
opt2 = " System ";
opt3 = " ";
opt4 = " By Olivier Poirier ";
opt5 = " ";
opt6 = " ";
Title=" - About - ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\n";
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
}
if (Choice=="programs"){
prgmloop:
system("color 2a");
system("CLS");
opt1 = " ";
if (Chickenvar==1){
opt1 = " - Hidden Items Revealed -";
}
opt2 = "-Word ";
opt3 = "-Text Adventure ";
opt4 = "-Exit ";
opt5 = " ";
if (Chickenvar==1){
opt5 = "-Special Documents ";
}
opt6 = " ";
Title=" User Login Access System ";
cout << Columnten1<< Title<< Columnten2 << "\n" ;
cout<< Bdr<< opt1<< Bdr<<"\n";
cout<< Bdr<< opt2<< Bdr<<"\n";
cout<< Bdr<< opt3<< Bdr<<"\n";
cout<< Bdr<< opt4<< Bdr<<"\n";
cout<< Bdr<< opt5<< Bdr<<"\n";
cout<< Bdr<< opt6<< Bdr<<"\n";
cout<<WaitColumn<<"\nEnter Password:";
cin >>Choice;
for(unsigned int n = 0; n < Choice.length(); ++n) {
Choice[n] = tolower(Choice[n]);
}
if (Choice=="exit"){
goto loopmainmenu;
}
}
}
goto loopmainmenu;
exitmain:
CMD=1;
system("CLS");
}
if (Choice=="clear"){
CMD=1;
system("CLS");
}
goto loop;
loopend:
return 0;
}
最佳答案
我将您的代码粘贴到VS2013中的新源文件中,然后在“编辑”菜单上的“高级”->“设置文档格式”中。这可以整理代码的缩进和布局。然后,从视觉上可以清楚地看出,您已关闭int main()
函数,而此代码紧随其后,编译器拒绝了该代码。您的标签loopend
在函数外部,因此在函数内部不可见。
int main() {
... ... ...
goto loopmainmenu;
exitmain:
CMD = 1;
system("CLS");
}
if (Choice == "clear"){
CMD = 1;
system("CLS");
}
goto loop;
loopend:
return 0;
}
int main()
。
goto
语句。
if (Choice == "Chicken"){
if (Chickenvar == 0){
Chickenvar = 1;
cout << "Chicken Mode Enabled";
goto Chicken_toggle_end;
}
if (Chickenvar == 1){
Chickenvar = 0;
goto Chicken_toggle_end;
cout << "Chicken Mode Disabled";
}
Chicken_toggle_end:
CMD = 1;
goto loop;
}
if (Choice == "Chicken"){
if (Chickenvar == 0){
Chickenvar = 1;
cout << "Chicken Mode Enabled";
}
if (Chickenvar == 1){
Chickenvar = 0;
cout << "Chicken Mode Disabled";
}
CMD = 1;
}
goto loop
将逻辑放入
while
循环中。
Goto
逻辑很难理解。
关于c++ - 奇怪的错误: label 'loopend' used but not defined, expected unqualified-id before “if ” (same error for “goto” and “' }' token ” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37370221/
在whatsapp中,如果消息很短,文本和时间在同一行。如果消息很长,时间在右下角 - 上面的文字。 我如何在 Ios 中使用 Storyboard 实现此目的 最佳答案 尝试使用类似这样的方法来定义
我有这段代码: label.control-label{ font-weight: bold; } label.control-label::after{ content: ":";
尊敬的社区成员, 我想将测试中的文本放在 div 的中心。代码如下所示: Testing everything: 现在,如果我尝试以下代码部分: Testing everything: 它不会在
我有一个 DIV 元素,它有一个 并在其中输入文本框。 基本上,我在 DIV 元素上启用了 jQuery .resizable(),但是当您使 DIV 元素小于当前大小时,文本框会被推到新的一行。 我
请考虑以下标记。 This is a label 对我来说,这个标记是在我的自定义工具提示控件之后生成的。我在 IE 上的 JAWS 上看到的问题是它只读取“标题,而不是标签”,但是对于其他屏幕阅读
我正在按照文档使用 ionic 2 构建应用程序。我已经实现了一个带有 fab-list 的 fab 按钮。我试图在包含按钮旁边放置一个描述性标签。开箱即用的 ionic 2 似乎无法在 float
通常我使用标签标签来指向这样的输入标签 First Name: 现在我有了这个 First Name: 由于我以前没有穿过这样的东西,是否可以为 label 添加 label 标签。当我应用 Ja
我有一个包含换行符(“\r”)的传入文本字符串。 当我输出它时: System.out.println(myString) , 回车被解释。 但是,当我将字符串设置为标签的内容时,它会忽略回车。 如何
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 1年前关闭。 Improve thi
在 Excel 2013 中,我使用单元格中的值标记散点图。我希望标签不重叠。我可以手动移动标签,但我创建了一个过滤器来自动创建新绘图,因此我希望标签冲突也能自动发生。 这可能吗?无需 VBA 的解决
在我的 Struts2 JSP 中,我想显示一个 id,所以我写道: A${id}B ( A 和 B 用于调试) 我希望它显示为 Id:A7B 但 HTML 中生成了以下内容:A7BId: 为什么标签
我想要一个带注释的 AST,所以我定义了那些递归数据结构 使用 Fix : data Term a = Abstraction Name a | Application a a | Var
这两种方法都没有记录,并且似乎没有达到我的预期。 mylabel.setFontScale(3f); 使明显文本变大 3 倍(我正在寻找的),但与 Align.center 一起使用时无法正确居中>.
ScrollView里面有两个Label(多边的),下面是TableView(其中行数可能不同) Label 和 TableView 的高度都没有设置。 所有 outlet 都对彼此上方和下方的缩进设
我很好奇是否有一种简单的方法可以使标签采用 CSS 样式属性的默认值。我的复选框采用了我的选项卡的属性,我只希望它们成为默认值。正如您将看到的,我更改了复选框的字体大小,使其小于选项卡。但是,我不想仅
asp:label 和 html label 有什么区别? 我知道第一个是在服务器上呈现的,所以基本上它会返回一个跨度选项卡,但它有什么用呢?在什么情况下需要使用 HTML 标记,在什么情况下需要使用
我需要从网站中提取所有城市名称。我在以前的项目中使用了 beautifulSoup 和 RE,但在这个网站上,城市名称是常规文本的一部分,没有特定的格式。我找到了满足我要求的地理包 ( https:/
您好,我正在尝试添加 到表格的每个单元格。我在这里使用 Material 表:https://material-table.com/#/docs/features/component-overridi
我想制作一个简单的 R 图,y 轴标签位于 y 轴刻度标签上方。我用下面的代码创建了我喜欢的东西。但是它需要对 at 进行一些摸索。图形参数。 问:有没有更简单的方法来做到这一点?有没有办法查询 y
我可以绘制以下 df 的标签使用 geom_text : df 1 8 var 2 426 -276 hours worked per week N
我是一名优秀的程序员,十分优秀!