fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. char input1 , input2 , temp;
  6.  
  7. std::cout << "Please enter two letters: ";
  8. std::cin >> input1 >> input2; //you can also do something like:
  9. //std::cout << "Please enter the first letter: ";
  10. //std::cin >> input1;
  11. //std::cout << "Please enter the second letter: ";
  12. //std::cin >> input2;
  13.  
  14. std::cout << "The letters between " << input1 << " and " << input2 << " are:" << std::endl;
  15.  
  16. //the out put will be weird if you try and start with a lower case and end
  17. //with an uppercase or vice versa
  18. //either make them both lower or both upper
  19. //alterative tell the user to make them both uper or lower.
  20. for( temp = input1 + 1; temp < input2; ++temp )
  21. {
  22. std::cout << temp << ' ';
  23. }
  24. return(0);
  25. }
Success #stdin #stdout 0s 3344KB
stdin
A E
stdout
Please enter two letters: The letters between A and E are:
B C D