fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string name;
  7.  
  8. cout << "enter your name: ";
  9. cin >> name;
  10.  
  11. char last = name[name.length() -1];
  12.  
  13. if (last == 'A' || last == 'a') {
  14. cout << "this is probably a female name.\n";
  15. } else {
  16. cout << "this is probably a male name.\n";
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
enter your name: this is probably a male name.