Please someone help me how to read specific data from a file, like email adresses, URL's, integer type data, character type data and other.
please someone help me,, i am new to C++
This is my code but it have errors, i have tried mybest to fix it but failed, please somebody help me
#include <fstream>
#include <iostream>
#include <string>
#include<vector>
using namespace std;
int main()
{
string target;
int pos = 0;
bool is_found = false;
ifstream infile;
//make a custom made container that can hold a line of text
struct line_struct
{
string line_number;
string two_letters;
string a_number;
};
//now make a bunch of containers
vector<line_struct> text_file;
//make a temporary container
line_struct temp;
//read the text file
while(infile)
{
//load the temporary container
//read in the text file, 'word at a time'
infile >> temp.line_number;
infile >> temp.two_letters;
infile >> temp.a_number;
//load the text_file vector with a 'line of text'
text_file.push_back(temp);
}
cout << "Enter something ye' wish to find in ye' text file: ";
cin >> target;
i have got help from net,,
there is an error in the lines
vector<line_struct> text_file;
if(target == text_file[i].line_number || target == text_file[i].two_letters || target == text_file[i].a_number)