In this exercise, your program will read a first name and last name (separated by a space) from a file (name.txt), each string is up to 10 characters. Store them in two c-strings, i.e., two character arrays, e.g., firstName, lastName, with enough space to

computer science

Description

In this exercise, your program will read a first name and last name (separated by a space) from a file (name.txt), each string is up to 10 characters. Store them in two c-strings, i.e., two character arrays, e.g., firstName, lastName, with enough space to store them. What is the minimum size of each array (but still enough to store the names)? Use that number to declare the arrays (otherwise, your program will waste memory space). After reading the first name and last name, then your program will call a function, e.g., generate FullName, which will combine the first name and last name and save it to the third array. The full name should appear in the format of last name, first name, where the last name comes first, then a comma and space and then the first name. Think about how large the array of the full name needs to be; and do not forget to count the extra comma and space. The function will take four arguments: the array that stores the first name, the array that stores the last name, the array that stores the full name, and the size of the array that stores the full name. Why do we need the size of the array here? The program will output the full name to a file called “fullname.txt” after calling the function. You may not use %s with scanf or gets, which are not safe as we mentioned in the class. Must use %c with fscanf to read two strings.

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.