//Required code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string f,l;
cout<<"Enter first name: ";
getline(cin,f);
cout<<"Enter last name: ";
getline(cin,l);
string t = f + " " + l;
int n = t.length();
cout<<"Length of first name is:
"<<f.length()<<endl;
cout<<"Length of last name is:
"<<l.length()<<endl;
cout<<"Total length + a space is:
"<<n<<endl;
if(n<=20){
cout<<"Full name
need not be shortened: "<<endl;
cout<<t<<endl;
} else {
cout<<"Full name
is too long and will be shortened to: "<<endl;
for(int
i=0;i<20;i++){
cout<<t[i];
}
cout<<endl;
}
return 0;
}
Please refer to the screenshot of the code to understand the indentation of the code

Sample Run:

Hope this helped. Please do upvote and if there are any queries please ask in comments section.
c/c++ 6 Using some of the library string handling functions Here, you are to read first...
c/c++
Last name: First name: ID: Sec: The name, ID and section number that appear at the beginning of the output of the program should be your own, not the ones used in the sample Note: results printed must show the data entered at run time, not the data shown in the sample run below! Sample run: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24...
c/c++
6 The name, ID and section number that appear at the beginning of the output of the program should be your own, not the ones used in the sample 7 Note: results printed must show the data entered at run time, not the data shown in the sample run below! Sample run: My name: Smith, Peter My ID: 300999999 My section: 001 Enter your last name : Smith Enter your first name: Peter 8 9 10 11 12 13...
c/c++
Passing arrays as arguments to functions. The main() is given, write the function 'average' (Study the syntax of passing an array as a function parameter) The program prompts the user to first enter the number of tests given in a course, and then prompts him/her to enter the mark for each test. The marks are stored in an array. This takes place in the main() function. It then passes the array to a function named 'average' that calculates and...
c/c++
This is a simple debugging question. The program (as written) tries to add up the elements of two arrays and store the results into a third array. The idea is that every element of the third array equals the sum of the two corresponding (i.e same index or position in the array) elements in the first two arrays. There is a syntax error, because the way it is written is not the correct way to do it. You are...
C program help #include #include #include void PrintName(char firstname[16], char lastname[16]); int main () { char firstname[16]; char lastname[16]; printf("please enter your first name:"); scanf("%s",firstname); printf("please enter your last name:"); scanf("%s",lastname); PrintName(firstname,lastname); return 0; } void PrintName(char firstname[16], char lastname[16]){ char fullname[34]; *fullname=*firstname+*lastname; (char*) malloc (sizeof (*fullname)); if (strlen(firstname) > 16||strlen(lastname)>16||strlen(fullname)>16) fflush(stdin); else printf(" the full name is %s %s \n",firstname,lastname); printf(" the full name is-> %s",fullname);/*why is one not run*/ return 0; }
use Java and it must work for any name
String Manipulator Write a program to manipulate Strings. Store your full name into one String variable. It must include first name, middle name, last name, cach separated by spaces. Spaces could vary. If you do not have a middle name make up one For example the string to be processed could be any of the following John Plain Doe John Plain Doc John Plain Doe Your program must be able to...
Using C Programming, Write a program that prompts for the user's first and last names. Declare a third array that will hold the user's last name and first name, separated by a comma and space. Use loops to inter through the names one character at a time, storing them into the full name array. Don't forget about the terminating character. Sample run: Enter your first name: john Enter your last name: matthews First name: John Last name: Matthews Full name:...
You must use C Language. The Main Objective: Make the first and last name ALL CAPITALS even if the user types in lower case letters. Lastly, flip the first name and last name around. So: HEIDI, HATFIELD to HATFIELD, HEIDI. (PLEASE uppercase all the letters) End Goal: HATFIELD, HEIDI KAISER, RUSSELL LIPSHUTZ, HOWARD PENKERT, DAWN WRIGHT, ELIZABETH Please use this reference below, to fix the code given. Code given is below, I want the user to be able to enter...
****Using C and only C****
I have some C code that has the function addRecord, to add a
record to a linked list of records. However, when I run it, the
program exits after asking the user to input the address. See
picture below:
Here is my code:
#include<stdio.h>
#include<stdlib.h>
struct record
{
int accountno;
char name[25];
char address[80];
struct record* next;
};
void addRecord(struct record* newRecord) //Function For Adding
Record at last in a SinglyLinkedList
{
struct record *current,*start,*temp;...
If x wame_Test_%232_2020W.pdf 2. Fill in the proper type specifiers in the two printf() statements in the C program shown below. Save your completed file as <YourName>_Test2_2.cpp. (5 Marks] When you are finished, copy all of the source code into this Word document (replacing the code below). Make sure the formatting from Visual Studio is preserved. Question 2: Code Replace this code with your source code. *** Test #2, Question #2, ETEC128 #include <stdio.h> #include <stdlib.h> int main(void) //********** Enter...