Need help: 1. (TCO 7) Given the following string variable, write a statement tha
ID: 3540788 • Letter: N
Question
Need help:
1. (TCO 7) Given the following string variable, write a statement that would replace the word string in str1 with the word "STRING".
string str1 = "Here is an example string";
(Points : 5)
2. (TCO 7) Given the following string variables, write a statement that would store the concatenation of str1 and str2 into str3.
string str1 = "Here is an ";
string str2 = "example string";
string str3;
(Points : 5)
3. (TCO 7) 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;
(Points : 5)
Explanation / Answer
1.string str2="string";
string str3="STF"
str1.replace( str.find(str2), str2.length(), str3);
2.strcpy(str3,str1);
strcat(str3,str2);
3.printf("%s-----%d------%f",name,age,salary);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.