Tuesday, 5 January 2016

Delimiter in String

Delimiter in String


Structure of the Problem Requirements  
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


No comments:

Post a Comment