Last active
December 25, 2015 10:18
-
-
Save MaratB/6960271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
#include <string.h> | |
main() | |
{ | |
char pass[] = "пароль", // правильный пароль | |
s[80]; | |
printf ("Введите пароль:\n "); | |
gets(s); | |
if ( strcmp ( pass, s )){ | |
printf ( "Неверный пароль " ); | |
return 1; // Выхд по ошибке 1 | |
} | |
printf ("Введите строку: \n"); | |
gets(s); | |
while ( s[i] != '\0' ) { | |
if (s[i]== ' ') i++; // с учетом, что между фиврами может находиться 1 пробел | |
if ( s[i] >= '0' && s[i] <= '9' ) | |
i++; | |
count ++; | |
} | |
printf("\nНайдено %d цифр", count); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment