Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please explain the steps, thank you IMPORTANT: read_line function to be used: int read_line(char *str, int n) { int ch, i = 0; while ((ch
Please explain the steps, thank you
IMPORTANT: read_line function to be used:
int read_line(char *str, int n) { int ch, i = 0; while ((ch = getchar()) != ' '){ if (i
1. (50 points) A store has decided to provide discount codes to university students during a promotional event. University students can submit their request for their unique discount codes (associated with their email address) by entering their university email address on the store's website. Write a program to verify if the domain name of an email address ends with .edu. The program should display a message that indicates whether it is a valid email address for the discount code. Example input/output: Input: lily23@yahoo.com Output: Not eligible for discount code Input: joe1997@mail.usf.edu Output: Verification successful Input: vpatel@fsu.edu Output: Verification successful 1) Name your program validate_email.c. 2) Your program should include the following function: int validate (char *s1); The validate function expects sl to point to a string containing the input for an email address as a string. If the email address ends with .edu, the function returns 1 and returns 0 otherwise. The validate 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. 3) Assume input is no longer than 1000 characters. Assume the input contains no more than one qualifying web address. 4) String library functions are NOT allowed for this program. If you use a string library function, you will NOT receive the credit for the validate function part of the program. 5) To read a line of text, use the read_line function (the pointer version) in the lecture notes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started