パスワードプログラムが機能しない....plsヘルプ....正しい入力の場合も間違ったパスワードが表示されます
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream.h>
void main()
{
clrscr();
int ctr=0;
int o;
char pass[5];
cout<<"enter password";
for(int i=0;i<5 && (o=getch())!=13 ;i++)
{
pass[i]=o;
putch('*');
}
ctr=strcmp(pass,"luck");
cout<<ctr;
if(ctr==0)
{
cout<<"welcome";
}
else
{
cout<<"wrong password";
}
getch();
}
このパスワードプログラムが機能しない理由を知りたいのですが...他の方法です