Write a program that inputs a string from the keyboard and determines the length of the string. Print the string in a field width that is twice the length of the string.
What will be an ideal response?
```
#include
#include
#include
using namespace std;
int main()
{
string input; // string to hold input string
int stringLength; // variable used to hold length of string
// ask user for string and store in character array
cout << "Enter a string: ";
cin >> input;
stringLength = input.length(); // get length of string
// display length of string
cout << "the length of the string is " << stringLength << endl;
// print string using twice the length as field with
cout << setw( 2 * stringLength ) << input << endl;
} // end main
```
Enter a string: castle
the length of the string is 6
castle
You might also like to view...
The Word Web App includes page formatting tools such as page borders, page centering, and watermarks
Indicate whether the statement is true or false
The ____ firewall topology consists of a packet filtering router that forwards all incoming packets to the firewall software on a bastion host.
A. packet-filtering router B. demilitarized zone C. single-homed bastion D. dual-homed bastion
MLA stands for ________ Language Association.
Fill in the blank(s) with the appropriate word(s).
I am using a thin client to access a server that will handle the heavy workload. The only requirement for the Thin Client is to display image from server, play audio from the server, and transfer mouse and keyboard commands to the server. The actual application and processing will be handle at the server in its workspace also called what?
A. VDE B. VPN C. VLAN D. STP