C# Задача 7. List Manipulation Advanced - Lab
Здравейте,
Mоже ли да проверите защо получавам 90/100? и къде е грешката
Благодаря,
решението:
7. List Manipulation Advanced - Pastebin.com
Next, we are going to implement more complicated list commands, extending the previous task. Again, read a list and keep reading commands until you receive "end":
Contains {number} – check if the list contains the number and if so - print "Yes", otherwise print "No such number".
PrintEven – print all the even numbers, separated by a space.
PrintOdd – print all the odd numbers, separated by a space.
GetSum – print the sum of all the numbers.
Filter {condition} {number} – print all the numbers that fulfill the given condition. The condition will be either '<', '>', ">=", "<=".
After the end command, print the list only if you have made some changes to the original list. Changes are made only from the commands from the previous task.
Example
Input |
Output |
2 13 43 876 342 23 543 Contains 100 Contains 543 PrintEven PrintOdd GetSum Filter >= 43 Filter < 100 end |
No such number Yes 2 876 342 13 43 23 543 1842 43 876 342 543 2 13 43 23 |
Предишната:
6.List Manipulation Basics
Write a program that reads a list of integers. Then until you receive "end", you will receive different commands:
Add {number}: add a number to the end of the list.
Remove {number}: remove a number from the list.
RemoveAt {index}: remove a number at a given index.
Insert {number} {index}: insert a number at a given index.
Note: All the indices will be valid!
When you receive the "end" command, print the final state of the list (separated by spaces).
Example
Input |
Output |
4 19 2 53 6 43 Add 3 Remove 2 RemoveAt 1 Insert 8 3 end |
4 53 6 8 43 3 |
Thank you for your reply
Best regards
Maybe it's a loophole that breaks the code.
It is interesting whether there is a variant in which the number and sum of the elements are equal and the collections are different.
Best,