www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/16/19:00:41

From: Erik <edroszcz AT algonet DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: What is wrong here?
Date: Mon, 15 Jun 1998 22:40:01 +0200
Organization: Algonet/Tninet
Lines: 35
Message-ID: <358586A1.6BD84ACD@algonet.se>
NNTP-Posting-Host: du232-2.ppp.algonet.se
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello!

Why isnīt this program woking?


#include <conio.h>
#include <iostream.h>
#include <string.h>

int main()
{
 clrscr();

 char user_name[5] = "test";
 char user_try[20];

 cout << "Enter password: ";
 cin >> user_try;

 if (!strcmp(user_try, user_name))
    cout << "Password Correct" << endl;
 else
    cout << "Wrong Password" << endl;

return 0;
}

It compiles good, but when I run the program and enter "test" it says:
"Wrong Password". What is wrong?

/Erik
edroszcz AT algonet DOT se



- Raw text -


  webmaster     delorie software   privacy  
  Copyright Đ 2019   by DJ Delorie     Updated Jul 2019