Can you please help me with my Problem here?
What I want to do is:

1. Input Username & Password (Make Password in Asterisk (*))
2. If it is True / Right Proceed to the Main Program
3. Else If False/Wrong give another Trial (Do you want to try again? Continue? (Y/N)
4. If ‘Y’ then go back to No.1
5. Else If ‘N’ then  exit program

The Error is this:
A. The Password is not masked in Asterisk (*)
I’ve tried to use this:
for(int i=0;i<8;i++)
    {
        pass[i]=getch();
        printf("*");
        pass[10] = passWord;
    }

But whenever I put a Wrong password as long as it is 8 letters and the Username is right It would still continue to Login! A Pain in the neck! HAHA



 B. Whenever Inputted “N” for the Trial Question.. It would still continue to the Main Program... 



I’ve  attached some codes of what I’ve done so far.

Can Somebody help me with this? 
Any response would be greatly appreciated!
Thanks in advance!

Recommended Answers

All 2 Replies

This is a C++ right? If so, can somebody move this to the C++ thread please?

Member Avatar for iamthwee

You're using getch to take the input, so you can't compare that input using the '==' operator as it isn't a string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.