#include <iostream>
#include <string>
int main()
{
string name;
string pre="Hello, ";
string msg;
while(1)
{
cout<<"Please enter your first name:";
cin >>name ;
msg=pre+name+"!";
int len=msg.length();
//line 1;
for(int i=0;i<len+4;i++)
cout<<"*";
cout<<"\n";
//line 2;
cout<<"*";
for(int i=0;i<len+2;i++)
cout<<" ";
cout<<"*\n";
//line 3;
cout<<"* ";
cout<<msg;
cout<<" *\n";
//line 4
cout<<"*";
for(int i=0;i<len+2;i++)
cout<<" ";
cout<<"*\n";
//line 5;
for(int i=0;i<len+4;i++)
cout<<"*";
cout<<"\n";
cout<<"Run again (Y/N): ";
string opt;
cin>>opt;
if(opt=="y"||opt=="Y")
continue;
else
break;
}
return 0;
}

#include <iostream>
#include <string>
int main()
{
string name;
string pre="Hello, ";
string msg;
while(1)
{
cout<<"Please enter your first name:";
cin >>name ;
msg=pre+name+"!";
int len=msg.length();
//line 1;
for(int i=0;i<len+4;i++)
cout<<"*";
cout<<"\n";
//line 2;
cout<<"*";
for(int i=0;i<len+2;i++)
cout<<" ";
cout<<"*\n";
//line 3;
cout<<"* ";
cout<<msg;
cout<<" *\n";
//line 4
cout<<"*";
for(int i=0;i<len+2;i++)
cout<<" ";
cout<<"*\n";
//line 5;
for(int i=0;i<len+4;i++)
cout<<"*";
cout<<"\n";
cout<<"Run again (Y/N): ";
string opt;
cin>>opt;
if(opt=="y"||opt=="Y")
continue;
else
break;
}
return 0;
}

1. Write a C++ program to output a framed greeting. The program will produce five lines...
In this lab, you will write a C program to encrypt a file. The program prompts the user to enter a key (maximum of 5 bytes), then the program uses the key to encrypt the file. Note that the user might enter more than 5 characters, but only the first 5 are used. If a new line before the five characters, the key is padded with 'a'; Note that the new line is not a part of the key, but...
In c programming, I need to write a program that reverses each of the lines in a file. The program accepts two command line arguments: The first one is the name of the input file The second is the name of the output file If the user didn't give two filenames, display an error message and exit. The program reads in each line of the input file and writes each line in reverse to the output file. Note, the lines...
What to submit: your answers to exercises 2. Write a Java program to perform the following tasks: The program should ask the user for the name of an input file and the name of an output file. It should then open the input file as a text file (if the input file does not exist it should throw an exception) and read the contents line by line. It should also open the output file as a text file and write...
Design a modular program using pseudo-code which prompts a user for their first name, followed by their last name; then displays a "Hello" salutation which concatenates their first name with their last name. Sample output (user input shown in red): Please enter your first name: John Please enter your last name: Smith Hello, John Smith! Your program must include a main module and one function; this function prompts the user for either their first name or last name, using a...
Cipher Program Specifications: You are to write a program called, "Cipher123" that reads in an encoded message using the 1-2-3 cipher and returns the decoded message. The program should continue prompting for additional encoded messages until the user chooses to quit the program. When decoding a message, we take the first letter of the first word, the second letter of the second word and the third letter of the third word and concatenate them. We repeat this same process 1-2-3...
Greeter Write a function that takes in a person's name, and prints out a greeting. The greeting must be at least three lines, and the person's name must be in each line. example: Hello name How are you do name Nice to meet you name Use your function to greet at least three different people. Full Names Write a function that takes in a first name and a last name, and prints out a nicely formatted full name, in a...
In C++, Write a program that reads in a length in meters and will output the equivalent length in feet and inches. Express feet as an integer and inches to the nearest 1/100 of an inch. You must write and use a function that uses the following function prototype to perform the calculation: void MtoFtIn(double meters, int& feet, double& inches); The function should not input any data or print any results, it only does the calculation. Include a loop that...
Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter the last name: Lee Hello Tom Lee. You are 21 years old. Press any key */ Declare an array named: firstName The array is a c_string, i.e., it is a null-terminated character array. The size of the array is 10. Assign a first name to it when it is declared. Declare an array named: lastName The array is a c_string, The size of the...
Write and test a function in C++ that uses the binary search algorithm to search an array of sorted strings – use a do..while loop to allow user to perform multiple searches w/o terminating the program – see sample output below. Use this name array: string names[SIZE] = { "Collins, Bill", "Smith, Bart", "Allen, Jim", "Griffin, Jim", "Stamey, Marty", "Rose, Geri", "Taylor, Terri", "Johnson, Jill", "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", "James, Jean", "Weaver, Jim", "Pore, Bob",...
C++ (1) Write a program to prompt the user for an input and output file name. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs. For example, (user input shown in caps in first line, and in second case, trying to write to a folder which you may not have write authority in) Enter input filename: DOESNOTEXIST.T Error opening input file: DOESNOTEXIST.T...