A simple program for:

Let user input a sentence, and two numbers.
Lets each alphabet assigned a number rank,(from increasing left to right)(any space is also counted)

now the output has to be all the alphabets that fall between the user inputted numbers ends inclusive.

Please Use the simplest language and only Iostream.

CONTINUE FROM HERE:

#include<iostream>
using namespace std;
int main()
{
cout<< "Type In complete Sentence"<<endl;
string s;
int i,m,n,o;
getline(cin,s);
cout<<"Type in the first & second number"<<endl;
cin>> m >> n;


}

Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>	
using namespace std;
int main()
{
  cout<< "Type In complete Sentence"<<endl;
  string s;
  string result = "";
  int i,m,n,o;
  getline(cin,s);
  cout<<"Type in the first & second number"<<endl;
  cin>> m >> n;

  for(int i = m-1; i < n-1; i++){
    result+=s[i]; }
  cout << result;


}
Topic archived. No new replies allowed.