using System; using System.Collections.Generic; class myass { public static void Main(string[] args) { // Convertions int a = int.Parse(Console.ReadLine()); double b = double.Parse(Console.ReadLine()); char c = char.Parse(Console.ReadLine()); string st = Console.ReadLine(); Convert.ToInt16(value); Convert.ToDouble(value); Convert.ToString(value); Random rand = new Random(); rand.Next(0, 1); // כולל את הראשון לא כולל את האחרון string st = ""; string st2 = ""; st.CompareTo(stringtocompare); // גדול = 1 קטן = -1 שווה = 0 st.Remove(start, count); // זה מתחיל מסטארט והולך קאונט צעדים קדימה st.Replace(oldchar, chartoreplace); // מחליף את התו הראשון בשני לכל אורך המחרוזת st.Substring(start, count); // זה מתחיל מסטארט והולך קאונט צעדים קדימה st.IndexOf(chartofind); // המיקום הראשון של התו במחרוזת אם אין חוזר -1 st.Insert(pos, stringtoinsert); // מכניס מערך למחרוזת לפני הנקודה פוס // Math Math.Abs(val1); Math.Max(val1, val2); Math.Min(val1, val2); int.MinValue; int.MaxValue; // פירוק מחרוזת לרווחים string[] b = st.split(' '); // בסוגריים רשום התו לפיו מפרקים // מיון מערך בסדר עולה int[] a = new int[50]; for (int n = 0; n < a.Length; n++) for (int i = 0; i < a.Length - 1; i++) { if (a[i] > a[i + 1]) // הסדר נקבע ע"פ סימן זה { int temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; } } // מציאת ערך מינימלי במערך int temp = int.MaxValue; for (int i = 0; i < a.Length; i++) if (a[i] < temp) temp = a[i]; /* public override string ToString() { return (st); } */ // הוספת אן איברים לשרשרת object chain = new object(value, reftonextobject); Console.WriteLine("enter where"); int n = int.Parse(Console.ReadLine()); Console.WriteLine("enter howmany"); int w = int.Parse(Console.ReadLine()); Console.WriteLine("what do you want to add 1"); object temp = new object(int.Parse(Console.ReadLine()), null); object temp2 = temp; object temp3 = chain1; for (int i = 1; i < w; i++) { Console.WriteLine("what do you want to add " + i + 1); int value = int.Parse(Console.ReadLine()); temp2.setnext(new object(value, null)); temp2 = temp2.getnext(); } if (n > 0) // במיקום אחר מתחילת השרשרת { for (int i = 1; i < n; i++) temp3 = temp3.getnext(); temp2.setnext(temp3.getnext()); temp3.setnext(temp); temp = null; temp2 = null; temp3 = null; } if (n == 0) // בתחילת השרשרת { temp2.setnext(chain); temp2 = null; chain = null; } } // מחזיר העתקה מדוייקת של מחסנית ואינו משמיד את המחסנית public static Stack Copy(Stack a) { Stack b = new Stack(); Stack c = new Stack(); while (a.Count != 0) { c.Push(a.Peek()); b.Push(a.Pop()); } while (b.Count != 0) a.Push(b.Pop()); while (c.Count != 0) b.Push(c.Pop()); return b; } // בודק האם המחסנית מכילה את המספר !אזהרה! - משמיד את המחסנית public static bool Contain(Stack a, int b) { while (a.Count != 0) if (b == a.Pop()) return true; return false; } public static void Org(Stack a) { Stack result = new Stack(); while (a.Count != 0) result.Push(Max(a)); while (result.Count != 0) a.Push(result.Pop()); } // (מוצא את האיבר המקסימלי במחסנית מוציא אותו מן המחסנית ומחזיר אותו (ריטרן public static int Max(Stack a) { Stack result = new Stack(); int max = int.MinValue; while (a.Count != 0) { if (a.Peek() > max) max = a.Peek(); result.Push(a.Pop()); } while (result.Count != 0) { if (result.Peek() != max) a.Push(result.Peek()); result.Pop(); } return max; } }