Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1. Given the following string variables, write a statement that would a

ID: 3555436 • Letter: Q

Question

Question 1. Given the following string variables, write a statement that would add str2 to the end of str1. Do not use an assignment statement to do this.

string str1 = "Here is an ";
string str2 = "example string";

Question2. Given the following string variable, write a statement that would locate the position of "string" in the str1 variable and store the result in an int variable named pos.

string str1 = "Here is an example string";

Question 3. Create an output format statement which would generate lines in the table which appear as shown below. The Employee Name Field displays an employee name contained in the name variable. YYY displays an integer value from the age variable which ranges from 1 thru 100 and should be right justified. XXXXX.XX displays a monetary value from the salary variable which ranges from 0.01 to 99999.99 and should also be right justified. Use the variables shown below in your output statements.

Employee Name Field------YYY----$XXXXX.XX

char name[25]; int age; double salary;

Question 1. Given the following string variables, write a statement that would add str2 to the end of str1. Do not use an assignment statement to do this.

string str1 = "Here is an ";
string str2 = "example string";

Question2. Given the following string variable, write a statement that would locate the position of "string" in the str1 variable and store the result in an int variable named pos.

string str1 = "Here is an example string";

Question 3. Create an output format statement which would generate lines in the table which appear as shown below. The Employee Name Field displays an employee name contained in the name variable. YYY displays an integer value from the age variable which ranges from 1 thru 100 and should be right justified. XXXXX.XX displays a monetary value from the salary variable which ranges from 0.01 to 99999.99 and should also be right justified. Use the variables shown below in your output statements.

Employee Name Field------YYY----$XXXXX.XX

char name[25]; int age; double salary;

Explanation / Answer

1. str1 + str2

2 int index = str.find("string");

3 for(int i =0 ; i< 25 ; i++)

{

cout<<Employee Name Field<<"------"<<YYY<<"----$"<<XXXXX.XX<<endl;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote