Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main.cs
- using System;
- using Unit4.CollectionsLib;
- using System.Linq;
- using System.Text;
- namespace רונית_תמותי
- {
- class Program
- {
- public static Node<SubList> MakeSubList(Node<int> n)
- {
- Node<SubList> tempSub;
- Node<SubList> subL = new Node<SubList>(new SubList(0, n, 0));
- Node<int> tmp = n;
- int sum, count;
- while (tmp != null)
- {
- sum = count = 0;
- while (tmp.GetInfo() != 0)
- {
- count++;
- sub += tmp.GetInfo();
- tmp = tmp.GetNext();
- }
- subL.GetInfo().Sum = sum;
- subL.GetInfo().Count = count;
- tempSub = new Node<SubList>(new SubList(0, tmp, 0));
- tempSub.SetNext(subL);
- subL = tempSub;
- }
- return subL;
- }
- static void Main(string[] args)
- {
- }
- }
- }
- *******
- SubList.cs
- using System;
- using Unit4.CollectionsLib;
- using System.Linq;
- using System.Text;
- namespace רונית_תמותי
- {
- public class SubList
- {
- private Node<int> p;
- private int count;
- private int sum;
- public SubList(int count, Node<int> p, int sum)
- {
- this.count = count;
- this.p = p;
- this.sum = sum;
- }
- public int Count
- {
- get { return this.count; }
- set { this.count = value; }
- }
- public Node<int> Pointer
- {
- get { return this.p; }
- set { this.p = value; }
- }
- public int Sum
- {
- get { return this.sum; }
- set { this.sum = value; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement