Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- int main()
- {
- RusPrint(); // Русские буквы
- char Text[128]= "0abcde 12 fghi239jklmn 1 opqr20stuvw 509 xyz 34 ";
- int Num= 0; int coef= 1; int sum=0;
- for (int a= strlen(Text)-1; a>-1; a--)
- {
- if (isdigit(Text[a])) { Num= Num+(Text[a]-48)*coef; coef*=10; }
- else { coef= 1; sum+= Num; Num= 0; }
- }
- printf("%s\n", Text);
- printf("\nСумма должна быть= 815, а получилось %d\n", sum);
- system("pause");
- return 0;
- }
- //////////
- void RusPrint(void)
- {
- //Руссификация сообщений
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- SetConsoleTitle("ОтветыМейлРу");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement