Tuesday 26 April 2016

String.h Library function STRUPR

This function converts the lower case string or statement into upper case statement.
#include <iostream>
#include <stdio.h>
using namespace std;
void strupr(char []);

int main()
{
    char arr[2000];
    cout<<"Enter the statement : "<<endl;
    gets(arr);
    cout<<"After converting small case letter letters into uppercase letters : "<<endl;
    strupr(arr);
    cout<<arr;
    return 0;
}
void strupr(char array[])
{
    int i=0;
    while(array[i]!='\0')
    {
        if(array[i]>='a' && array[i]<='z')
        {
            array[i]=array[i]-32;
        }
        i++;
    }
}

No comments:

Post a Comment