PracticeDev/study_cpp/cpp_primer_source_code/Chapter 5/compstr2.cpp

18 lines
392 B
C++

// compstr2.cpp -- comparing strings using arrays
#include <iostream>
#include <string> // string class
int main()
{
using namespace std;
string word = "?ate";
for (char ch = 'a'; word != "mate"; ch++)
{
cout << word << endl;
word[0] = ch;
}
cout << "After loop ends, word is " << word << endl;
// cin.get();
return 0;
}