+ 3

String comparison in C or C++ for password verification. Code will help.

Comparing strings in C or C++

2nd Mar 2017, 4:47 PM
Zemuldo
Zemuldo - avatar
1 Réponse
+ 1
use the strcmp() function in the string.h standard header it returns 0 if the strings are the same. #include <stdio.h> #include <strings.h> int main(){ char pasword[] = "historia"; char userinput[19]; scanf("%s", userinput); if(strcmp(pasword, userinput)==0){ printf("access"); }else{ return 0; }}
2nd Mar 2017, 4:59 PM
sebipincha
sebipincha - avatar