Skip to content

Instantly share code, notes, and snippets.

@MaratB
Last active December 25, 2015 10:18
Show Gist options
  • Save MaratB/6960271 to your computer and use it in GitHub Desktop.
Save MaratB/6960271 to your computer and use it in GitHub Desktop.
#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