Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include <stdio.h>
- #include <ctype.h>
- #include <stdlib.h>
- using namespace std;
- ifstream fin("A.txt");
- int main()
- {
- unsigned k = 0;
- char s[31];
- while (fin.getline(s, 31))
- {
- char *p = strtok(s, "+=");
- int nr1 = atoi(p);
- p = strtok(NULL, "+=");
- int nr2 = atoi(p);
- p = strtok(NULL, "+=");
- int res = atoi(p);
- if (nr1 + nr2 == res)
- k++;
- }
- cout << k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement