RE: SLC21 Week3 - Strings in C

You are viewing a single comment's thread from:

SLC21 Week3 - Strings in C

in slc21w3sergeyk •  8 days ago 
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. References have appeared in the c++ language, they are like disguised pointers, they allow you to change the variables that are passed to the function. When you wrote add_elements, it was probably a demo function. What is the point of expanding the array without adding elements. And in the check (size+num<=N) and the like, equality should be excluded, since it will already be outside the array 2.5/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&lt&lts; => FEDCBA A good explanation even with a picture)) and even without strlen() 1/1
Swap neighboring letters char s[]="ABCDEF";.....your code.....cout&lt&lts; => BADCFE That's right, also a pole for research)) 1+/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&lt&lts&lt&lt"\n"&lt&ltx; => BCDEFA aabrakadabr It's true, it's even good that it was designed in the form of functions - but I would advise you to make the functions more universal - to shift not the entire line - but parts of it. For example, from 3 positions to 8. 1.5/1.5
Remove all vowel letters char s[]="this is some text";...your code...cout&lt&lts; => ths s sm txt Of course this is all learning, but I would write "silent" functions. That is, if the function has to delete letters, then it should do only that (and the fact that it was deleted or not should be reported through variables) 1.5/1.5
Double each vowel letter char s[]="this is some text";...your code...cout&lt&lts; => thiis iis soomee teext The insertion of the doubled symbol could be made into a function, then the code would look nicer and clearer 1.6/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&lts&ltss; => (this is some text) len of s => 17 number =27
Total: 9.1/10
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

What is the point of expanding the array without adding elements. And in the check (size+num<=N) and the like, equality should be excluded, since it will already be outside the array

Could you please elaborate these points?