Advertisement
eric11144

test.cpp

Feb 19th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. string::size_type find_char(const string &s, char c)
  9. {
  10. string::size_type i = 0;
  11. while(i != s.size() && s[i] != c)
  12. ++i;
  13. return i ;
  14. }
  15.  
  16. bool is_sentence(const string &s)
  17. {
  18. char b = '.';
  19. return (find_char(s, b) == s.size() - 1);
  20. }
  21.  
  22. int main()
  23. {
  24. string a = "adadadqeqead,";
  25. is_sentence(a);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement