Lab1 Ex3
You cannot submit for this problem because the homework's deadline is due.
Ex3. Operations on strings (6 marks)
Ex3_1. Conversion (3 marks)
Get a number represented as a string from user input using input('', 's')
(notice the second parameter 's'
) and convert the string to a number.
Hint: Use str2num()
. See its documentation and pay attention to the format requirements. Also read the note on the documentation page.
Sample Test Cases
Input:
123.4
Output:
123.4000
Input:
wtcl555
Output:
Ex3_2. String concatenation (3 marks)
Concatenate two strings s1
and s2
obtained from user input.
Hint: You can either use strcat()
or regard the strings as arrays.
Sample Test Case
Input:
wtcl
555
Output:
wtcl555
Lab1 Exercises
- Status
- Finished
- Problems
- 5
- Open Since
- 2022-05-19 18:15
- DDL
- 2022-05-21 00:00
- Extension
- 24.0 hour(s)