Question 1: Given the following string variables, write a statement that would a
ID: 3636013 • 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";
Question 2:
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 that would generate lines in the table which appear as shown below. The Item Description Field displays a description of the item contained in the desc variable. YYYY displays an integer value from the qty variable which ranges from 1 thru 9999 and should be right justified. XXXX.XX displays a monetary value from the cost variable which ranges from 0.01 to 9999.99 and should also be right justified. Use the variables shown below in your output statements.
Item Description Field........YYYY.....$XXXX.XX
string desc; int qty; double cost;
{Answer all three and you get an A (if they are right), two you get a B, one and so on.}
Explanation / Answer
Q1 : str1.append(str2); Q2 : int position; position = str1.IndexOf("string");
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.