hi every 1 i am new and Ihope that you would help me I have to write a program that will allow you to enter if you enter the password without using strcmp function and here is my try
one method can be that u match each and every character of the string user had given in the input.....
code can be like this ---
gets(string);
i = 0,count=0;
while(string[i] != '\0')
{ if(string[i]==str[i])
count++;
i++;
}
if(count==strlen(str))
printf("Access granted");
else
printf("acess denied");
>if( s=="pass")
If we could do this, why would we need strcmp?
>gets(s);
gets is evil. There's no way to make it safe, so you would do well to forget it even exists.
Let's get you started off in the right direction. Unless you're a stubborn C programmer who can't see the benefit of C++ I/O, use iostreams for you input and output:
can I ask you narue why you are angree I did not see you are code when I thanks harshchandra any way I am sorry if i have done any thing that would make you mad of me
I'm back again, my well runneth dry and I'm thristy for more knowledge
Quote originally posted by Narue ...
>if( s=="pass")
If we could do this, why would we need strcmp?
>gets(s);
gets is evil. There's no way to make it safe, so you would do well to forget it even exists.
Let's get you started off in the right direction. Unless you're a stubborn C programmer who can't see the benefit of C++ I/O, use iostreams for you input and output:
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.