Sunday 3 April 2016

String.h Library strpbrk (How strpbrk works ? )

STPBRK : This function takes an array(string) of alphabets input from user and if user enters any number other than ABC alphabets it should display those integers or characters.


Here is the code : >>
#include <iostream>
#include <stdio.h>
using namespace std;
void strpbrk(char []);
int main()
{
    char arr[200];
    cout<<"Enter the statement : "<<endl;
    gets(arr);
    strpbrk(arr);
    return 0;
}
void strpbrk(char array[])
{
    int i=0;
    while(array[i]!='\0')
    {
        if(array[i]>='a' && array[i]<='z'){}
        else if(array[i]>='A' && array[i]<='Z'){}
        else {
            cout<<array[i];
        }
        i++;
    }
}

No comments:

Post a Comment