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

Write a program email. c that asks the user for a first and last name, and print

ID: 3925662 • Letter: W

Question

Write a program email. c that asks the user for a first and last name, and prints out the user's UCSD email ID consisting of the first letter of the first name followed by at most 7 letters of the last name. The first name is assumed to consist of a single word and everything after the first space are assumed to be part of the last name. When creating the email ID, convert all letters to lower case, and ignore any hyphens and any spaces in the last name. You can assume that the user will always enter at least two words. (~)$ a. out Name: Hillary Clinton UCSD email ID: hclinton@ucsd.edu (~) $ a. out Name: Elizabeth Bowes-Lyon UCSD email ID: ebowesly@ucsd.edu (~) $ a. out Name: Andrew lloyd webber UCSD email ID: alloydwe@ucsd.edu (~) $ a. out Name: Jean-Claude Van Damme UCSD email ID: jvandamm@ucsd.edu (~)$

Explanation / Answer

#include<stdio.h>

char toLowerCase(char );

int main()
{
char firstName[100], lastName[100],email[30];
scanf("%s",firstName);
scanf("%s",lastName);
int index = 0,i = 0;
email[index++] = toLowerCase(firstName[0]);
while(index < 8)
{
if(lastName[i] == '')
break;
if(lastName[i] != ' ' || lastName[i] != '-')
email[index++] = toLowerCase(lastName[i]);
i++;
}
printf("%s ", email );
}

char toLowerCase(char c)
{
char output;
int temp = c;
printf("%d ", temp);
if((int)c >= 97 && (int)c <= 122)
output = c;
else
{
output = (c%65 + 97);
}
printf("%c ", output);
return output;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote