Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void problema2(const char *input_file_name, const char *output_file_name)
- {
- int sem = 0;
- int cuv = 0;
- ifstream fin(input_file_name);
- ofstream fout(output_file_name);
- char s[2001];
- char chr[] = ".,-;:'\"()...?!";
- while ( fin.getline(s, 2000) )
- {
- for (unsigned int i = 0 ; i<strlen(s) ; i++)
- {
- if ((s[i] >= '1' && s[i] <= '9') || (s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
- {
- cuv++;
- while ((s[i] >= '1' && s[i] <= '9') || (s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
- i++;
- }
- if ( strchr(chr, s[i]) && (i+2 < strlen(s)))//s[i+1] != NULL && s[i+2] != NULL)
- {
- if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.')
- i = i + 2;
- sem++;
- }
- }
- }
- fout << cuv << '\n';
- fout << sem << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement