The faulty program below is supposed to print out every othe
Solution
#include <iostream>
using namespace std;
int main()
 {
 cout<<\"Enter a word:\";
 string s;
 cin>>s; //cin<< should be changed to cin>>
 int x=0; //initialize x
 int y=s.length();
 string z=\"\"; //initialize z
 while(y>=x)
 {
 z=z+s.substr(x,1);
 x=x+2; // x++ will print all the letters so, make it x+2
 }
 cout<<\"The string with every other letter is:\"<<z<<endl;
 }

