Task | Comment | Grade |
---|---|---|
Practically (i.e., with code examples) explain the theory from the first part of this lesson, where the concept of two sizes of an array is discussed. Demonstrate how to make it look like the array size can be increased/decreased. All loops should work with the array size stored in the size variable. Keep the physical, actual size in the constant N. | Good explanation, and you correctly noticed that when adding symbols (as opposed to numbers) you need to additionally add a null terminator, and when removing this you don't need to do this | 3/3 |
Declare a string variable (store any sentence in the array). Task: reverse the string, i.e., write it backward. For example: char s[]="ABCDEF";.....your code.....cout<<s; => FEDCBA | You did not complete this task completely, the line should be flipped "on its own", you made an imitation of such a flip, as I explained, but to do it properly - you should have used an additional array - and copied the flipped one into it. Perhaps this would lead to an idea of how to do the task correctly | 0.8/1 |
Swap neighboring letters char s[]="ABCDEF";.....your code.....cout<<s; => BADCFE | probably did not notice this task(( | 0/1 |
Shift the string cyclically to the left (it’s easier to start with this), then cyclically to the right. char s[]="ABCDEF", x[]="abrakadabra";.....your code.....cout<<s<<"\n"<<x; => BCDEFA aabrakadabr | a well-executed line shift to the left/right and there is an output of both. There is one ineffective and probably not obvious way that one of my students found. I will show this example in the end | 1.4/1.5 |
Remove all vowel letters char s[]="this is some text";...your code...cout<<s; => ths s sm txt | When meeting a vowel, the consonant does not simply move forward - two independent indices i and j are implemented. And as you can see, you can do without the strlen() function | 1.5/1.5 |
Double each vowel letter char s[]="this is some text";...your code...cout<<s; => thiis iis soomee teext | All the same, I would like you to think once more about the given task)) and do it without an additional array. The first time in line number 5, you did not specify the size of the array, so an array of the minimum size was created, calculated automatically from the line with which you initialize the array. But even if you put 100 or 1000 in square brackets, it would not solve the situation. This is when you step on your feet in a dance - you will fall. So your program crashed. Since once you (doubling the symbol) erased the zero terminator. The symbol must be INSERT by moving all the rest of the line to the right | 1.4/2 |
аAdditional task (1-2 points) - as a replacement for any of the tasks 2-6: Choose any number, preferably slightly larger than the length of the text. Increase the text length to the specified number by adding spaces between words. char s[]="this is some text";...your code...cout<s<ss; => (this is some text) len of s => 17 number =27 | ||
Total: | 8.1/10 |
RE: SLC21 Week3 - Strings in C
You are viewing a single comment's thread from:
SLC21 Week3 - Strings in C
Dear @sergeyk,
Thank you very much for your constructive feedback, which helps a lot to improve. Glad to score this amount even missed one task ( totally my fault lol ). Must say, I learn a lot ! Thank you so much for the valuable knowledge you shared.
-Vimukthi.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit