Write C++ program to change string to lower case without strlwr


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

Introduction

I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.


  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. void functionlower(char []);
  6.  
  7. int main()
  8. {
  9. char string[100];
  10.  
  11. cout<<"Enter a string to convert it into lower case: "<<endl;
  12. cin>>string;
  13.  
  14. functionlower(string); // calling functionlower
  15.  
  16. cout<<"Entered string in lower case is: "<<string;
  17.  
  18. return 0;
  19. }
  20.  
  21. void functionlower(char s[]) {
  22. int c = 0;
  23.  
  24. while (s[c] != '\0') {
  25. if (s[c] >= 'A' && s[c] <= 'Z') {
  26. s[c] = s[c] + 32;
  27. }
  28. c++;
  29. }
  30. }
  31.  

Result

C++ language techstudy.org

     





Related Topics




Popular Posts