How to Use Delimiter in String

Delimiter can be used as a end point in any string. Delimiters are also used in filing as a end point or in tokens (words). We can use any character as a delimiter . In getline function just pass the cin , string and your delimiter .

Source Code

#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main () 
{
 string story;
 cout<<" \t \t Enter Your Story and End it with Fullstop.\n ";
 getline(cin,story,'.');
 cout<<endl<<endl ;
 cout<<" \t \t \t \t Your Story  \n \n "<<story<<endl;
}

Output of the Program

Delimiter in String

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment