I'm reading the text from file sentence by sentence, I'm using the full stop(.) as a delimiter. If there is a new line character in between a sentence, how can i skip it??? like the text bellow:
Note:(File text cannot be changed)
--------Text--------
An aeroplane is in the sky. The rose is red. A
girl is playing there. Numbers are not
allowed in the password. There is a
playground.
--------------------
------------Code------------
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char sen[50] = { "\0" };
ifstream fin("text.txt");
while (!fin.eof())
{
fin.getline(sen, 49, '.');
cout << sen << endl;
}
}
---------------------------------------
--------------Out put---------------
An aeroplane is in the sky
The rose is red
A
girl is playing there
Numbers are not
allowed in the password
There is a
playground
---------------------------------------
------------Expected Output--------------
An aeroplane is in the sky
The rose is red
A girl is playing there
Numbers are not allowed in the password
There is a playground
-------------------------------------------