Hi,
I was given this problem:
"The user will enter two letters. These letters will be stored in a string using cin.getline. Replace the first letter entered with the second letter entered." The next problem we have will be to replace the letters in a sentence, but I'm stuck on this first part. Heres what I have done so far:
#include <iostream>
#include <cstring>
using namespace std;
int main(void)
{
const int charString = 2;
char sentenceHolder[charString];
int index;
char exitOnInput;
cout << "Enter two character's" << endl;
cin.getline(sentenceHolder, charString);
for(index=0; index < charString; index++)
{
cout << sentenceHolder[index];
}
cout << "Enter a letter followed by 'enter' to exit" << endl;
cin >> exitOnInput;
return 0;
}
LOL I have no Idea how to do this... Any help would be greatly appreciated.