Hi, the following program is designed to take a string of input from the user and then put it into an array and manipulate it. For example, if they were to type 'hi', it would be translated to an array of {'h','i' }. Currently, I cannot get my program to work like this:
.Code:#include <iostream> using namespace std; int main() { int test; int x; int position=0; char sample[8]; cout << "-> "; cin >> sample[]; cout << "The First character you entered was " << sample[0] << "\n"; cout << "The second character you entered was " << sample[1] << "\n"; if(sample[2]=='h') { cout << "You did type the letter h"; } return 0; }
Thanks in advance for your help,
mintsmike