{"id":10039,"date":"2023-11-06T12:14:53","date_gmt":"2023-11-06T12:14:53","guid":{"rendered":"https:\/\/adelnasim.com\/docs\/courses\/cpp-tutorial\/one-dimensional-array-part-2\/"},"modified":"2024-04-07T01:19:35","modified_gmt":"2024-04-07T01:19:35","slug":"one-dimensional-array-part-2","status":"publish","type":"docs","link":"https:\/\/adelnasim.com\/ar\/docs\/courses\/cpp-tutorial\/one-dimensional-array-part-2\/","title":{"rendered":"\u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u062d\u0627\u062f\u064a\u0629 \u0627\u0644\u0628\u0639\u062f One Dimensional Array (2)"},"content":{"rendered":"<p>\u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062a \u0645\u062a\u0639\u062f\u062f\u0629 \u0627\u0644\u0627\u0633\u062a\u062e\u062f\u0627\u0645\u0627\u062a \u0628\u0634\u0643\u0644 \u0644\u0627 \u064a\u0635\u062f\u0642\u060c \u0648\u064a\u0645\u0643\u0646\u0643 \u0625\u062c\u0631\u0627\u0621 \u0639\u0645\u0644\u064a\u0627\u062a \u0645\u062e\u062a\u0644\u0641\u0629 \u0639\u0644\u064a\u0647\u0627\u060c \u0645\u062b\u0644 \u0646\u0633\u062e \u0627\u0644\u0642\u064a\u0645 \u0627\u0644\u0623\u0648\u0644\u064a\u0629 \u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0645\u0648\u062c\u0648\u062f\u0629 \u0625\u0644\u0649 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u062e\u0631\u0649.<\/p>\n<p>\u0628\u0627\u0644\u0637\u0628\u0639 \u0644\u0627 \u064a\u0645\u0643\u0646\u0646\u0627 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0633\u0637\u0631 \u0627\u0644\u062a\u0627\u0644\u064a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">arr2 = arr1;<\/pre>\n<p>\u0644\u0623\u0646\u0646\u0627 \u0644\u0627 \u0646\u062e\u0635\u0635 \u0642\u064a\u0645\u0629 \u0648\u0627\u062d\u062f\u0629. \u062a\u062d\u062a\u0648\u064a \u0643\u0644 \u0645\u0635\u0641\u0648\u0641\u0629 \u0639\u0644\u0649 \u0645\u062c\u0645\u0648\u0639\u0629 \u0645\u0646 \u0627\u0644\u0642\u064a\u0645\u060c \u0644\u0630\u0644\u0643 \u0625\u0630\u0627 \u0623\u0631\u062f\u0646\u0627 \u062a\u0639\u064a\u064a\u0646 \u0642\u064a\u0645\u0629 \u0648\u0627\u062d\u062f\u0629 \u0641\u064a \u0645\u0635\u0641\u0648\u0641\u0629\u060c \u0641\u064a\u062c\u0628 \u0639\u0644\u064a\u0646\u0627 \u062a\u062d\u062f\u064a\u062f \u0645\u0648\u0642\u0639\u0647\u0627:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">arr2[0] = arr1[0];<\/pre>\n<p>\u0648\u0644\u0643\u0646 \u0645\u0627\u0630\u0627 \u0644\u0648 \u0623\u0631\u062f\u0646\u0627 \u062a\u0639\u064a\u064a\u0646 \u062c\u0645\u064a\u0639 \u0642\u064a\u0645 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u062e\u0631\u0649\u061f<\/p>\n<p><strong>\u0645\u062b\u0627\u0644 1:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const int s = 4;\r\n    int arr1[s] = { 10,20,30,40 };\r\n    int arr2[s];\r\n\r\n    for (size_t i = 0; i &lt;= s-1; i++)\r\n    {\r\n        arr2[i] = arr1[i];\r\n    }\r\n\r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        cout &lt;&lt; arr2[i] &lt;&lt; \" \";\r\n    }\r\n    cout &lt;&lt; endl;\r\n\r\n    return 0;\r\n}<\/pre>\n<p>\u064a\u0642\u0648\u0645 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0628\u062a\u0647\u064a\u0626\u0629 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 arr1 \u0628\u0627\u0644\u0642\u064a\u0645\u060c \u062b\u0645 \u064a\u0646\u0633\u062e \u0645\u062d\u062a\u0648\u064a\u0627\u062a arr1 \u0625\u0644\u0649 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u062e\u0631\u0649 arr2. \u0648\u0623\u062e\u064a\u0631\u0627\u060c \u0641\u0625\u0646\u0647 \u064a\u0637\u0628\u0639 \u0639\u0646\u0627\u0635\u0631 arr2. \u064a\u0648\u0636\u062d \u0647\u0630\u0627 \u0643\u064a\u0641\u064a\u0629 \u0646\u0633\u062e \u0645\u062d\u062a\u0648\u064a\u0627\u062a \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u0623\u062e\u0631\u0649 \u0641\u064a \u0644\u063a\u0629 C++.<\/p>\n<p>\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">10 20 30 40<\/pre>\n<p><strong>\u0645\u062b\u0627\u0644 2:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const int s = 5;\r\n    int arr[s] = { 100,200,200,500,0 };\r\n    int sum = 0;\r\n    \r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        \/\/sum += arr[i];\r\n        sum = sum + arr[i];\r\n    }\r\n    cout &lt;&lt; \"sum = \" &lt;&lt; sum &lt;&lt; endl;\r\n\r\n    return 0;\r\n}<\/pre>\n<p>\u064a\u062d\u0633\u0628 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0645\u062c\u0645\u0648\u0639 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0648\u062c\u0648\u062f\u0629 \u0641\u064a \u0645\u062c\u0645\u0648\u0639\u0629 \u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u062b\u0645 \u064a\u0637\u0628\u0639 \u0627\u0644\u0646\u062a\u064a\u062c\u0629 \u0639\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a. \u064a\u0648\u0636\u062d \u0643\u064a\u0641\u064a\u0629 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062d\u0644\u0642\u0629 \u0644\u0644\u062a\u0643\u0631\u0627\u0631 \u0639\u0628\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0648\u062a\u062c\u0645\u064a\u0639 \u0627\u0644\u0642\u064a\u0645.<\/p>\n<p>\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sum = 1000<\/pre>\n<p><strong>\u0645\u062b\u0627\u0644 3:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const int s = 5;\r\n    int arr[s] = { 100,200,200,500,100 };\r\n    long long d = 1;\r\n    \r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        d *= arr[i];\r\n    }\r\n    cout &lt;&lt; \"multi = \" &lt;&lt; d &lt;&lt; endl;\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<ul>\n<li><strong>long long d = 1;<\/strong> :\u064a\u0642\u0648\u0645 \u0647\u0630\u0627 \u0627\u0644\u0633\u0637\u0631 \u0628\u062a\u0647\u064a\u0626\u0629 \u0645\u062a\u063a\u064a\u0631 \u0635\u062d\u064a\u062d  long long  \u0645\u0646 d \u0625\u0644\u0649 1. \u0633\u064a\u062a\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0647\u0630\u0627 \u0627\u0644\u0645\u062a\u063a\u064a\u0631 \u0644\u062a\u062c\u0645\u064a\u0639 \u0646\u0627\u062a\u062c \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0648\u062c\u0648\u062f\u0629 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629.<\/li>\n<li>long long \u0647\u0648 \u0646\u0648\u0639 \u0628\u064a\u0627\u0646\u0627\u062a \u0641\u064a C++ \u064a\u0645\u062b\u0644 \u0639\u062f\u062f\u064b\u0627 \u0635\u062d\u064a\u062d\u064b\u0627 64 \u0628\u062a. \u0625\u0646\u0647 \u0645\u0635\u0645\u0645 \u0644\u062a\u062e\u0632\u064a\u0646 \u0642\u064a\u0645 \u0639\u062f\u062f\u064a\u0629 \u0643\u0628\u064a\u0631\u0629 \u062c\u062f\u064b\u0627. \u064a\u0645\u0643\u0646\u0647 \u0627\u0644\u0627\u062d\u062a\u0641\u0627\u0638 \u0628\u0646\u0637\u0627\u0642 \u0623\u0648\u0633\u0639 \u0645\u0646 \u0627\u0644\u0642\u064a\u0645 \u0645\u0642\u0627\u0631\u0646\u0629\u064b \u0628\u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u0627\u0644\u0639\u0627\u062f\u064a\u0629 \u0623\u0648 \u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u0627\u0644\u0637\u0648\u064a\u0644\u0629.<\/li>\n<li>\u0644\u0630\u0644\u0643\u060c \u0627\u0644\u0639\u0628\u0627\u0631\u0629  long long d = 1\u061b \u062a\u0639\u0644\u0646 \u0639\u0646 \u0645\u062a\u063a\u064a\u0631 \u0627\u0633\u0645\u0647 d \u0628\u0646\u0648\u0639 \u0628\u064a\u0627\u0646\u0627\u062a long long \u0648\u064a\u0642\u0648\u0645 \u0628\u062a\u0647\u064a\u0626\u062a\u0647 \u0628\u0627\u0644\u0642\u064a\u0645\u0629 1. \u0648\u064a\u0645\u0643\u0646 \u0628\u0639\u062f \u0630\u0644\u0643 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0647\u0630\u0627 \u0627\u0644\u0645\u062a\u063a\u064a\u0631 \u0644\u062a\u062e\u0632\u064a\u0646 \u0648\u0645\u0639\u0627\u0644\u062c\u0629 \u0627\u0644\u0642\u064a\u0645 \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u0627\u0644\u0643\u0628\u064a\u0631\u0629 \u0641\u064a \u0628\u0631\u0646\u0627\u0645\u062c\u0643.<\/li>\n<\/ul>\n<p>\u0628\u0627\u062e\u062a\u0635\u0627\u0631\u060c \u064a\u062d\u0633\u0628 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u062d\u0627\u0635\u0644 \u0636\u0631\u0628 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0648\u062c\u0648\u062f\u0629 \u0641\u064a \u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u062b\u0645 \u064a\u0637\u0628\u0639 \u0627\u0644\u0646\u062a\u064a\u062c\u0629 \u0639\u0644\u0649 \u0648\u062d\u062f\u0629 \u0627\u0644\u062a\u062d\u0643\u0645. \u064a\u0648\u0636\u062d \u0643\u064a\u0641\u064a\u0629 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062d\u0644\u0642\u0629 \u0644\u0644\u062a\u0643\u0631\u0627\u0631 \u0639\u0628\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0648\u062a\u062c\u0645\u064a\u0639 \u0645\u0646\u062a\u062c \u0639\u0646\u0627\u0635\u0631\u0647\u0627.<\/p>\n<p>\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">multi = 200000000000<\/pre>\n<p><strong>\u0645\u062b\u0627\u0644 4:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const int s = 5;\r\n    int arr[s] = { 100,200,200,501,101 };\r\n    int sumEven, sumOdd = 0;\r\n    \r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        if (arr[i] % 2 == 0)\r\n            sumEven += arr[i];\r\n        else\r\n            sumOdd += arr[i];\r\n    }\r\n    cout &lt;&lt; \"Sum of even numbers = \" &lt;&lt; sumEven &lt;&lt; endl;\r\n    cout &lt;&lt; \"Sum of odd numbers = \" &lt;&lt; sumOdd &lt;&lt; endl;\r\n\r\n    return 0;\r\n}<\/pre>\n<p>\u064a\u062d\u0633\u0628 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0645\u062c\u0645\u0648\u0639 \u0627\u0644\u0623\u0631\u0642\u0627\u0645 \u0627\u0644\u0632\u0648\u062c\u064a\u0629 \u0648\u0627\u0644\u0641\u0631\u062f\u064a\u0629 \u0628\u0634\u0643\u0644 \u0645\u0646\u0641\u0635\u0644 \u0641\u064a \u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u062b\u0645 \u064a\u0637\u0628\u0639 \u0627\u0644\u0646\u062a\u0627\u0626\u062c \u0639\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a.<\/p>\n<p>\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sum of even numbers = 500\r\nSum of odd numbers = 602<\/pre>\n<p><strong>\u0645\u062b\u0627\u0644 5:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const int s = 6;\r\n    int marks[s] = { 100,99,98,88,70,90 };\r\n    int sum = 0;\r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        sum += marks[i];\r\n    }\r\n    cout &lt;&lt; \"Average = \" &lt;&lt; sum \/ s &lt;&lt; endl;\r\n\r\n    return 0;\r\n}<\/pre>\n<p>\u064a\u062d\u0633\u0628 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0645\u062a\u0648\u0633\u0637 \u0627\u0644\u0639\u0644\u0627\u0645\u0627\u062a \u0627\u0644\u0645\u062e\u0632\u0646\u0629 \u0641\u064a \u0639\u0644\u0627\u0645\u0627\u062a \u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u062b\u0645 \u064a\u0637\u0628\u0639 \u0627\u0644\u0645\u062a\u0648\u0633\u0637 \u0625\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a.<\/p>\n<p>\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Average = 90<\/pre>\n<p><strong>\u0645\u062b\u0627\u0644 6:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const int s = 6;\r\n    int arr[s] = { 22,100,95,101,200,90 };\r\n    int max = 0;\r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        if (arr[i] &gt; max)\r\n            max = arr[i];\r\n    }\r\n    cout &lt;&lt; \"Maximum number = \" &lt;&lt; max &lt;&lt; endl;\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p>\u064a\u0639\u062b\u0631 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0639\u0644\u0649 \u0627\u0644\u062d\u062f \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0642\u064a\u0645\u0629 \u0628\u064a\u0646 \u0627\u0644\u0623\u0631\u0642\u0627\u0645 \u0627\u0644\u0645\u062e\u0632\u0646\u0629 \u0641\u064a \u0645\u062c\u0645\u0648\u0639\u0629 \u0627\u0644\u0623\u0639\u062f\u0627\u062f \u0627\u0644\u0635\u062d\u064a\u062d\u0629 \u062b\u0645 \u064a\u0637\u0628\u0639 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0642\u0635\u0648\u0649 \u0625\u0644\u0649 \u0634\u0627\u0634\u0629 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a.<\/p>\n<p>\u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Maximum number = 200<\/pre>\n<p><strong>\u0645\u062b\u0627\u0644 7:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    int vector[5];\r\n    cout &lt;&lt; \"Enter 5 numbers: \";\r\n    for (int i = 0; i &lt; 5; i++)\r\n        cin &gt;&gt; vector[i];\r\n    cout &lt;&lt; endl;\r\n    \r\n    int Element;\r\n    cout &lt;&lt; \"What is the element you are looking for? \";\r\n    cin &gt;&gt; Element;\r\n    \r\n    bool Found = false;\r\n    int i;\r\n    for (i = 0; i &lt; 5; i++)\r\n        if (Element == vector[i])\r\n        {\r\n            Found = true;\r\n            break;\r\n        }\r\n    cout &lt;&lt; endl;\r\n    if (Found)\r\n        cout &lt;&lt; Element &lt;&lt; \" found at position \" &lt;&lt; i &lt;&lt; endl;\r\n    else\r\n        cout &lt;&lt; Element &lt;&lt; \" is not in this array!\" &lt;&lt; endl;\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p>\u0641\u064a \u0643\u0648\u062f C++ \u0647\u0630\u0627\u060c \u0623\u0646\u062a \u062a\u0623\u062e\u0630 \u0645\u062f\u062e\u0644\u0627\u062a \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0644\u0645\u0644\u0621 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u0639\u062f\u0627\u062f \u0635\u062d\u064a\u062d\u0629 \"vector\" \u0628\u0627\u0644\u062d\u062c\u0645 5 \u062b\u0645 \u062a\u0628\u062d\u062b \u0639\u0646 \u0639\u0646\u0635\u0631 \u0645\u062d\u062f\u062f \u062f\u0627\u062e\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629. \u062f\u0639\u0648\u0646\u0627 \u0646\u062d\u0644\u0644 \u0627\u0644\u0643\u0648\u062f \u062e\u0637\u0648\u0629 \u0628\u062e\u0637\u0648\u0629:<\/p>\n<ol>\n<li>int vector[5];<br \/>\n- \u064a\u0639\u0644\u0646 \u0647\u0630\u0627 \u0627\u0644\u0633\u0637\u0631 \u0639\u0646 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u0639\u062f\u0627\u062f \u0635\u062d\u064a\u062d\u0629 \"vector\" \u0628\u062d\u062c\u0645 5\u060c \u0648\u0627\u0644\u062a\u064a \u064a\u0645\u0643\u0646\u0647\u0627 \u062a\u062e\u0632\u064a\u0646 \u0645\u0627 \u064a\u0635\u0644 \u0625\u0644\u0649 \u062e\u0645\u0633 \u0642\u064a\u0645 \u0635\u062d\u064a\u062d\u0629.<\/li>\n<li>Input Loop to Populate the Array:<br \/>\n- \u064a\u0637\u0644\u0628 \u0627\u0644\u0643\u0648\u062f \u0645\u0646 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0625\u062f\u062e\u0627\u0644 \u062e\u0645\u0633\u0629 \u0623\u0631\u0642\u0627\u0645 \u0648\u064a\u062e\u0632\u0646\u0647\u0627 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \"vector\" \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062d\u0644\u0642\u0629 \"for\" \u0627\u0644\u062a\u064a \u062a\u062a\u0643\u0631\u0631 \u062e\u0645\u0633 \u0645\u0631\u0627\u062a. \u064a\u062a\u0645 \u062a\u0639\u064a\u064a\u0646 \u0643\u0644 \u0625\u062f\u062e\u0627\u0644 \u0625\u0644\u0649 \u0639\u0646\u0635\u0631 \u0645\u062e\u062a\u0644\u0641 \u0645\u0646 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629.<\/li>\n<li>int Element;<br \/>\n- \u064a\u0639\u0644\u0646 \u0647\u0630\u0627 \u0627\u0644\u0633\u0637\u0631 \u0639\u0646 \u0645\u062a\u063a\u064a\u0631 \u0635\u062d\u064a\u062d \"Element\"\u060c \u0648\u0627\u0644\u0630\u064a \u0633\u064a\u062e\u0632\u0646 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u062a\u064a \u064a\u0628\u062d\u062b \u0639\u0646\u0647\u0627 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645.<\/li>\n<li>Prompt for the Element to Search:<br \/>\n- \u064a\u0637\u0644\u0628 \u0627\u0644\u0643\u0648\u062f \u0645\u0646 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0625\u062f\u062e\u0627\u0644 \u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u0630\u064a \u064a\u0631\u064a\u062f \u0627\u0644\u0628\u062d\u062b \u0639\u0646\u0647.<\/li>\n<li>Search Loop:<br \/>\n\u2013 \u064a\u062a\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062d\u0644\u0642\u0629 `for` \u0644\u0644\u0628\u062d\u062b \u0639\u0646 \u0627\u0644\u0639\u0646\u0635\u0631 \u062f\u0627\u062e\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629. \u0625\u0630\u0627 \u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0627\u0644\u0639\u0646\u0635\u0631\u060c \u062a\u0646\u0642\u0637\u0639 \u0627\u0644\u062d\u0644\u0642\u0629\u060c \u0648\u064a\u062a\u0645 \u062a\u0639\u064a\u064a\u0646 \u0639\u0644\u0627\u0645\u0629 \"Found\" \u0639\u0644\u0649 \"true\". \n\u0627\u0644\u0645\u062a\u063a\u064a\u0631 `i` \u064a\u062a\u062a\u0628\u0639 \u0627\u0644\u0645\u0648\u0636\u0639 \u0627\u0644\u0630\u064a \u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0627\u0644\u0639\u0646\u0635\u0631 \u0641\u064a\u0647.<\/li>\n<li>Output the Result:<br \/>\n- \u064a\u062a\u062d\u0642\u0642 \u0627\u0644\u0643\u0648\u062f \u0628\u0639\u062f \u0630\u0644\u0643 \u0645\u0646 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0627\u0644\u0639\u0646\u0635\u0631 (\u0639\u0644\u0649 \u0633\u0628\u064a\u0644 \u0627\u0644\u0645\u062b\u0627\u0644\u060c \"Found\" \u0647\u0648 \"true\"). \u0625\u0630\u0627 \u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u064a\u0647\u060c \u0641\u0625\u0646\u0647 \u064a\u0639\u0631\u0636 \u0627\u0644\u0639\u0646\u0635\u0631 \u0648\u0645\u0648\u0636\u0639\u0647 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629. \u0625\u0630\u0627 \u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u064a\u0647\u060c \u0641\u0625\u0646\u0647 \u064a\u0639\u0644\u0645 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0623\u0646 \u0627\u0644\u0639\u0646\u0635\u0631 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629.<\/li>\n<\/ol>\n<p>\u0628\u0627\u062e\u062a\u0635\u0627\u0631\u060c \u064a\u0633\u0645\u062d \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0628\u0625\u062f\u062e\u0627\u0644 \u062e\u0645\u0633\u0629 \u0623\u0631\u0642\u0627\u0645 \u0641\u064a \u0645\u0635\u0641\u0648\u0641\u0629 \u062b\u0645 \u0627\u0644\u0628\u062d\u062b \u0639\u0646 \u0639\u0646\u0635\u0631 \u0645\u0639\u064a\u0646 \u062f\u0627\u062e\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629. \u0648\u064a\u0642\u062f\u0645 \u0645\u0644\u0627\u062d\u0638\u0627\u062a \u062d\u0648\u0644 \u0645\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0642\u062f \u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0627\u0644\u0639\u0646\u0635\u0631 \u0648\u0645\u0648\u0636\u0639\u0647 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629.<\/p>","protected":false},"excerpt":{"rendered":"<p>Arrays are incredibly versatile, and you can perform various operations on them, such as copying the initial values of an existing array into another one. Of course we cannot use the following command: arr2 = arr1; Because we aren&#8217;t assigning a single value. Each array has a collection of values, so if we need to [&hellip;]<\/p>","protected":false},"author":3,"featured_media":0,"parent":2744,"menu_order":31,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-10039","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/10039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/comments?post=10039"}],"version-history":[{"count":13,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/10039\/revisions"}],"predecessor-version":[{"id":10052,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/10039\/revisions\/10052"}],"up":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/2744"}],"wp:attachment":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/media?parent=10039"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/doc_tag?post=10039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}