// G. Hagopian--Memorize the digits in Pi
#include
using namespace std;
const string pi = "3.1415926535897932384626433832795";
int main() {
string input;
int counter{ 0 };
cout << "Enter your approximation for pi: ";
cin >> input;
for (int i = 0; i < 34; ++i) {
if (input[i] == pi[i]) ++counter;
else break;
}
cout << "Congratulations, you guessed " << counter-1 << "correct digits.\n"
<< "The first you missed was pi[" << counter << "] = " << pi[counter] << endl;
cout << "\nTry again: ";
cin >> input;
int i = 0;
while (pi[i] == input[i])
++i;
cout << "Congratulations, you guessed " << i << "correct digits.\n"
<< "The first you missed was pi[" << i << "] = " << pi[i] << endl;
}