The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Program homework on strings in c and command line arguments
Â
1. (60 points) Write a program to extract Web addresses starting withwww.and ending with.edu. The program displays Webaddress contained in the input entered by the user. If the input does not contain a web address that starts withwww.and endswith.edu, the program should display a message that indicates such a web address cannot be found.Input: http://www.usf.edu/admissionOutput: www.usf.eduInput:https://www.facebook.com/Output: Web address starting with www. and ending with .edunot foundYour program should include the following function:void extract(char *s1, char *s2);The function expectss1to point to a string containing the input as a string andstoresthe output to the string pointed bys2.1) Name your programextract.c.2) Assume input is no longer than 1000 characters. Assume the input contains nomore than one qualifying web address.3) Theextractfuncton should use poin±er ari±hmetc (ins±ead of array subscriptng). In o±her words, elimina±e ±he loop indexvariables and all use of ±he [] opera±or in ±he functon.4) To read a line of text, use theread_linefunction (the pointer version) in the lecture notes.2. (40 points) Write a program that finds either the largest or smallest of theten numbers as command-line arguments. With –l forlargest and –s for smallest number, if the user enters an invalid option, the program should display an error message.Example runs ofthe program:./find_largest_smallest –l 5 2 92 424 53 42 8 12 23 41output: The largest number is 424./find_largest_smallest –s 5 2 92 424 53 42 8 12 23 41output: The smallest number is 2.1) Name your program numbers.c.2) Useatoifunction in<stdlib.h>to convert a string to integer form..3) Generate the executable asfind_largest_smallest.gcc –Wall –o find_largest_smallest numbers.c
Attachments:
-----------