《如果》未找到标识符
我是一个 C++ 初学者,我在 Visual Studio 2010 中的 if 循环上总是遇到问题
#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
using namespace std;
int main(void){
string name;
int money;
cout << "Hello, Enter your name here: ";
cin >> name;
cout << "\n\nHello " << name << ".\n\n";
cout << "\nEnter your salary here:L";
cin >> money;
If(money <= 50000 || money >= 100000 );
{
cout << "\nGood!\n";
} else if(money >=49999){
cout << "\nJust begin to work?\n"
} else if(money <= 100000){
cout << "\nWow!, you're rich\n";
}else{
cout << "\nMillionaire\n";
}
system("PAUSE");
return 0;
}
,编译器说找不到“If”标识符。 请需要帮助。 谢谢巴拉米
I am a beginner C++ learner and I always have a problem on if loop in visual studio 2010
#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
using namespace std;
int main(void){
string name;
int money;
cout << "Hello, Enter your name here: ";
cin >> name;
cout << "\n\nHello " << name << ".\n\n";
cout << "\nEnter your salary here:L";
cin >> money;
If(money <= 50000 || money >= 100000 );
{
cout << "\nGood!\n";
} else if(money >=49999){
cout << "\nJust begin to work?\n"
} else if(money <= 100000){
cout << "\nWow!, you're rich\n";
}else{
cout << "\nMillionaire\n";
}
system("PAUSE");
return 0;
}
And the compiler said 'If' identifier can not be found.
Help needed please.
Thanks
Baramee
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
if
并不指定循环,而是指定条件。请注意,它是小写的if
,而不是您的If
。另外,您需要删除结尾的分号。
这一行:
什么也不做。
以下:
如果条件为真,则执行第一个块。
if
doesn't designate a loop, but a conditional. Note that it's lower-caseif
, as opposed to what you have -If
.Also, you need to remove the trailing semicolon.
This line:
does nothing.
The following:
executes the first block if the condition is true.
C++ 与许多编程语言一样,区分大小写。确保您输入的是
if
,而不是If
。C++, like many programming languages, is case-sensitive. Make sure you type it as
if
, notIf
.