Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- int main()
- {
- int counter = 0;
- string line;
- cout << "Enter a line of text\n";
- getline(cin, line);
- for (int sub = 0; sub < line.length(); sub++)
- {
- if (ispunct(line[sub]))
- {
- counter++;
- }
- }
- cout << "Punctuation character count: " << counter << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement