Skip to main content

C++ questions

4 replies [Last post]
Offline
Joined: 11 Jan 2013

Can anyone help me out on following?
How we can convert character or integer values to the password form(encrypted form) in C++?
If i put write password then insted of printing the characters, how it should be shown in the encrypted form?

sanjeev's picture
Offline
Joined: 21 Feb 2011
I assume you are using Windows for C++ programming
Hi Richa,
I assume you are working on Windows platform.
I am not good at C++ but I think C code would work. You can change it in C++ which should not be so tough.

Code:
[c]
#include<stdio.h>
#include <conio.h>   
int main()
{
    char alpha,pass[10];
    int i;
    while( (alpha=getch())!= '\n');{
        pass[i] = alpha;
        printf("*");
        i++;
    }
    return 1;
}
[/c]

Note: This code would work only on windows. In Linux conio.h is not defined and moreover there is already a function which does the same thing i.e. getpass();
Here is the reference link for the same: http://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/getpass....

Hope this will help you

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Offline
Joined: 11 Jan 2013
Hii Sanjeev,  Thanks for ur
Hii Sanjeev, 
Thanks for ur help. But i have tried it using compiler Dev C++. Its not showing anythng on the output screen.
sanjeev's picture
Offline
Joined: 21 Feb 2011
in which OS you are running
Hi Richa,
In which O.S. you are working onand can you please share your code with the output that you are getting?

What you had to show at output screen and when depends upon your code. So please paste your code here.

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Umesh Kumar (not verified)
Explaining the same thing
Explaining the same thing what you are looking for.
Check it out : http://www.cplusplus.com/articles/E6vU7k9E/

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.