xxxxxxxxxx
User will enter long text with colon separated. example Book:Pen:Pencil:Table:Desk
a. Use String object to store user input value (string str)
b. You must print the values one after another, after splitting the string using delimiter (:)
Book
Pen
Pencil
xxxxxxxxxx
#include <iostream>
#include <fstream>
#include <string>
ifstream file("filename.txt");
string data = "";
while(getline(file, data,','))
{
cout << data << endl;
}
file.close();