fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4. using namespace std;
  5.  
  6. int main() {
  7. string input;
  8. cout << "Enter string to calculate: ";
  9. cin >> input;
  10.  
  11. cmatch logElements;
  12. regex logRegex("(log)|(ln)|(lg)");
  13. if (regex_search(input.c_str(), logElements, logRegex)){
  14. for (int i = 0; i < logElements.size(); i++){
  15. cout << logElements[i] << endl;
  16. }
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 15336KB
stdin
Standard input is empty
stdout
Enter string to calculate: