Answered You can hire a professional tutor to get the answer.

QUESTION

Write a program to extract Web addresses starting with www. and ending with . The program displays Web address contained in the input entered by the...

Write a program to extract Web addresses starting with www. and ending with .edu. The program displays Web address contained in the input entered by the user. If the input does not contain a web address that starts with www. and ends with .edu, the program should display a message that indicates such a web address cannot be found.

Your program should include the following function:

void extract(char *s1, char *s2);

The function expects s1 to point to a string containing the input as a string and stores the output to the string pointed by s2.

1) Name your program extract.c.

2) Assume input is no longer than 1000 characters. Assume the input contains no more than one qualifying web address.

3) The extract function should use pointer arithmetic (instead of array subscripting). In other words, eliminate the loop index variables and all use of the [] operator in the function.

4) To read a line of text, use the read_line function (the pointer version) :

int read_line(char str[], int n) 

{    int ch, i = 0;    while ((ch = getchar()) != 'n')

       if (i < n)         str[i++] = ch;     str[i] = '';   /* terminates string */     return i;        /* number of characters stored */

}

#include &lt;stdio.h&gt;#include &lt;string.h&gt;int read_line(char str, int n){int ch, i = 0;while ((ch = getchar()) != '\n')if (i &lt; n)str[i++] = ch;str[i] = '\0';/* terminates string...
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question