Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use strings, string member function, parallel arrays, and array functions. Compa

ID: 3848300 • Letter: U

Question

Use strings, string member function, parallel arrays, and array functions. Companies often search internet websites for the purpose of data collections. Program collect information for indexing the sites and collecting other information such as email addresses, phone numbers, ect. You've been asked to access a websites and only extract email addresses from it. The site file often has the extension". html', See below for an example site that you can use. Email addresses are tagged within the html document as follows (note that other formats may be included): Send email Send email Send email where "bob$@ohio.edu" is the email address, "bob" is the user name, and "ohio .edu" is the domain name. Write a program that processes a website file and extracts all the email addresses from the site, and stores the emails in parallel arrays (emails, users, domains). You only need to extract email addresses that conform to the tag formats specified above. Write a function that outputs the data to a file as follows: Email user domains bob8 ohio.edu bob ohio.edu bob.smith8ace.cs.ohio.edu bob.smith ace.cs.ohio edu cs 24008 gmail.com Cs 2400 gmail.com bob8bob-cats.ohio.edu bob bob-cats.ohio.edu Read the input file one line at a time, and process it. Note that a line may have more than one email address. Process lines until the end of the input (He is reached For

Explanation / Answer

SOURCE CODE:

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
void main()
{

rename("a.html","a.txt");
clrscr();
int i,u,b,k=0;
char email[10][50];
char line[100],line1[100];
ifstream fin("a.txt");
while(!fin.eof())
{
fin.getline(line,200,' ');


for(i=0;i<16;i++)
{
line1[i]=line[i];
}
line1[16]='';

if((strcmp(line1,"<a href="mailto:"))==0)
{


i=16;
u=0;


while(1)
{
b=line[i];
if(b==34) break;

email[k][u]=line[i];
i++;
u++;
}
email[k][u]='';
k++;
}
   else continue;
}
int j;
for(i=1;i<k;i++)
{
if((strcmp(email[i],email[i-1]))==0)
{


for(j=i;j<k;j++)
{
strcpy(email[j],email[j+1]);
}
k--;
}

}
cout<<" Email ID Domain ";
for(i=0;i<k;i++)
{

for(j=0;email[i][j]!='';j++)
{

cout<<email[i][j];

}
cout<<" ";

for(j=0;email[i][j]!='@';j++)
{

cout<<email[i][j];

}
cout<<" ";
for(;email[i][j]!='';j++)
{

cout<<email[i][j];

}
cout<<endl;
}
rename("a.txt","a.html");
getch();
}