Page 1 of 1

C++ language pls double check instruction and examples! use character arrays . pls explain your code with comments . tha

Posted: Tue Jul 05, 2022 10:27 am
by answerhappygod
C++ language
pls double check instruction and examples!
use character arrays .
pls explain your code with comments .
thank u
C Language Pls Double Check Instruction And Examples Use Character Arrays Pls Explain Your Code With Comments Tha 1
C Language Pls Double Check Instruction And Examples Use Character Arrays Pls Explain Your Code With Comments Tha 1 (200.83 KiB) Viewed 11 times
C Language Pls Double Check Instruction And Examples Use Character Arrays Pls Explain Your Code With Comments Tha 2
C Language Pls Double Check Instruction And Examples Use Character Arrays Pls Explain Your Code With Comments Tha 2 (41.57 KiB) Viewed 11 times
getline Function The function getline (String_var, Max_Characters+1) reads characters from stream and stores them into String_var until Max Characters number of characters have been read or a newline character is reached, whichever happens first. char a[80], b[80]; cout << "Enter two sentences: \n"; cin.getline(a, 80); cin.getline (b, 80); cout << "a = " << a << "\nb = " << b << endl; Sample Interaction: Enter two sentences: Today is Friday. Happy Friday! a = Today is Friday. b = Happy Friday! DISPLAY 8.1 Some Predefined C-String Functions in Function strcpy(Target_String_Var, Src_String) strncpy(Target_String_Var, Src String, Limit) strcat(Target_String_Var, Src_String) strncat(Target_String_Var, Src_String, Limit) strlen(Src_String) Description Copies the C-string value Src_String into the C-string variable Target_String_Var. The same as the two-argument strcpy except that at most Limit characters are copied. Concatenates the C-string value Src_String onto the end of the C string in the C-string variable Target_String_Var. The same as the two-argument strcat except that at most Limit characters are appended. Returns an integer equal to the length of Src_String. (The null character, '\0', is not counted in the length.) You MUST use C-strings for todays tasks. Cautions Does not check to make sure Target_String_Var is large enough to hold the value Src_String. If Limit is chosen carefully, this is safer than the two- argument version of strcpy. Not implemented in all versions of C++. Does not check to see that Target_String_Var is large enough to hold the result of the concatenation. If Limit is chosen carefully, this is safer than the two- argument version of strcat. Not implemented in all versions of C++.
Task 3: Signature Generation Write a program that asks the user for: • Person Name (Max 100 characters) • Work Position (Maximum 100 characters) • Work Organization (Maximum 100 characters) On the basis of these values, create a signature C-string (single string). Your program should concatenate all the fields together into one C-string and print out that string. Use strncat for this task. Your program should have at least one more function other than the main function. Sample Interaction: Enter Name: John Mason Enter Position: Senior Vice President Enter Organization: SoftSystems LLC The signature is: Mason, Senior Vice President, SoftSystems LLC.