Please write code in c++ using iostream library.
Write a function that have to copy one char array to other avoiding any not-letter symbols, program have to use pointer.
Input:
First line contains sequence of chars (size is not more that
100).
1w[a3ter11
output: water
#include <iostream>
using namespace std;
int main()
{
// input character array
char input[1000];
// read input
cin >> input;
// copy to output array
char output[1000];
int i = 0, j = 0;
// till end of input
while (input[i] != 0)
{
// if current character is uppercase or lowercase letter
if ((input[i] >= 'a' && input[i] <= 'z') || input[i] >= 'A' && input[i] <= 'Z')
output[j++] = input[i];
i++;
}
// append null
output[j] = 0;
// print output
cout << output;
}
.
Output:
.
Get Answers For Free
Most questions answered within 1 hours.