Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #include <string.h>
- int zif(char* str, char* dlina, int i) {
- char zif[] = { '1', '2','3','4','5','6','7','8','9','0' };
- for (int j = 0; j < dlina-1; j++) {
- char* zife1 = strchr(zif, str[j]);
- char* zife2 = strchr(zif, str[j + 1]);
- if ((!(zife1)) && (!(zife2)))
- return 1;
- }
- return 0;
- }
- int main() {
- char str[81],
- zn[] = { '+','-','/','*' };
- SetConsoleCP(1251); SetConsoleOutputCP(1251);
- printf("Введите предложение: ");
- fgets(str, 81, stdin);
- int len = strlen(str) - 1;
- int stats = 0;
- for (int i = 0; str[i] != '\0'; i++) {
- char* znak = strchr(zn, str[i]);
- int zna = znak;
- if (zif(str, zna, i)) {
- printf("Неверно");
- return 0;
- }
- i += zna;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement