Monday, October 29, 2018

String Manipulation (output Answer)

#include<iostream>
using namespace std;
void u_strmanip(char s[])
{int i;
 for(i=0; s[i]!='\0'; i++)  // starts from first character till last
 {
  if(isupper(s[i]))
   s[i]=s[i]+1;
  else
  if(i%2!=0)
  s[i]=s[i+1];
  else
  if(!isalnum(s[i]))
  s[i]='*';
 
}
}
int main()
{
    // declare the string
    char name[40];
    //accept the string
   // cin>>name; // ignore space in between
    cin.getline(name,40); // accept space also
          //  cout<<name <<endl; // display string
   u_strmanip(name);
//display string in reverse order
cout<<name;
    system("pause");
    return 0;
}
   
    Give output for
CoMpuTEr SciENce 2019

Answer
DMNuuUF *TcEFOc *0099

   
   
   
   
    

No comments:

Post a Comment