【发布时间】:2015-11-18 14:38:12
【问题描述】:
我是 C++ 编程的初学者,我在学校有这个活动。我不断收到 [Error] ISO C++ forbids comparison between pointer and integer [-fpermissive] 在第 15 行。你如何解决这个问题?谢谢!
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int pass[5];
int x;
main()
{
cout<<"\nEnter pin code: ";
for(x=0;x<=4;x++)
{
pass[x]=getch();
putch('#');
}
if(pass==86222)
cout<<"\nW E L C O M E!";
else
cout<<"\nIncorrect Pin Code";
getch();
}
【问题讨论】:
-
你做事的方式很奇怪。如果你想比较
ints。拿和int,阅读并比较,为什么需要array? -
发布了一个简单的方法来做你正在尝试的事情。
-
@Haris 我们需要用# 或类似输入密码的方式隐藏密码。