Q:

Write a program that reads a string of characters including punctuation and writes what was read but with the punctuation removed

0

Write a program that reads a string of characters including punctuation and writes what was read but with the punctuation removed.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
#include <string>

int main() {
  std::string s;
  std::cin >> s;
  for (const auto &c : s)
    if (!ispunct(c))
      std::cout << c;
  std::cout << std::endl;

  return 0;
}
C++

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now