Advertisement
STANAANDREY

44 ba c

Oct 29th, 2019
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. #include <stdio.h>
  5. #include <ctype.h>
  6. #include <stdlib.h>
  7. using namespace std;
  8.  
  9. ifstream fin("A.txt");
  10.  
  11. int main()
  12. {
  13.     unsigned k = 0;
  14.     char s[31];
  15.     while (fin.getline(s, 31))
  16.     {
  17.         char *p = strtok(s, "+=");
  18.         int nr1 = atoi(p);
  19.         p = strtok(NULL, "+=");
  20.         int nr2 = atoi(p);
  21.         p = strtok(NULL, "+=");
  22.         int res = atoi(p);
  23.         if (nr1 + nr2 == res)
  24.             k++;
  25.     }
  26.  
  27.     cout << k;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement