I am having problems with my code involving arrays. I am asking the user to input letters until they enter an exclamation point. At that time, I am asking them to enter a number they want the letters to start reading, and a number they want to stop reading at.
So if you enter h e l l o w o r l d, and entered a 3 and 7, my program would read llowo.
All is good up til the point that the numbers are involved. Can anyone please help me? Thanks
#include <iostream>
using namespace std;
int main ()
{
char letter[100];
int n = 0;
int NumIn;
int NumOut;
do {
cout << "Enter letter (! to end): ";
cin >> letter[n];
cout << "You entered: " << letter[n] << endl;
n = n+1;
} while (letter[n-1] != '!');
cout << "Please enter a number that you want to start reading in: " << endl;
cin >> NumIn;
cout << "Please enter a number that you want to stop reading :" << endl;
cin >> NumOut;
int main ()
{
char letter[100];
int n = 0;
int NumIn;
int NumOut;
do {
cout << "Enter letter (! to end): ";
cin >> letter[n];
cout << "You entered: " << letter[n] << endl;
n = n+1;
} while (letter[n-1] != '!');
letter[n] = '\0';
cout << "Please enter a number that you want to start reading in: " << endl;
cin >> NumIn;
cout << "Please enter a number that you want to stop reading :" << endl;
cin >> NumOut;