Monday, April 27, 2020

118A. String Task Solution

  1. #include<iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. int main(){
  5. int i;
  6. char ch[100];
  7. cin>>ch;
  8.  
  9.  
  10. int size=std::strlen(ch);
  11.  
  12. ////cout<<size<<endl;
  13.  
  14. for(i=0;i<size;i++)
  15. {
  16. if(ch[i]=='a' ||ch[i]=='e' ||ch[i]=='i' ||ch[i]=='o' ||ch[i]=='u' ||ch[i]=='y' ||ch[i]=='A' ||ch[i]=='E' ||ch[i]=='I' ||ch[i]=='O' ||ch[i]=='U' ||ch[i]=='Y')
  17. continue;
  18. cout<<".";
  19. if(ch[i]>='A' && ch[i]<='Z')
  20. cout<<(char)tolower(ch[i]);
  21. else cout<<ch[i];
  22.  
  23.  
  24.  
  25. }
  26.  
  27. return 0;
  28.  
  29. }

No comments:

Post a Comment

Aptitude test assistant programmer 2018

 #include <stdio.h> #include <stdlib.h> int main() { char str[100]; int i; int space=0;     printf("Enter a string\n")...