compstr2.cpp 375 B

1234567891011121314151617
  1. // compstr2.cpp -- comparing strings using arrays
  2. #include <iostream>
  3. #include <string> // string class
  4. int main()
  5. {
  6. using namespace std;
  7. string word = "?ate";
  8. for (char ch = 'a'; word != "mate"; ch++)
  9. {
  10. cout << word << endl;
  11. word[0] = ch;
  12. }
  13. cout << "After loop ends, word is " << word << endl;
  14. // cin.get();
  15. return 0;
  16. }