ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﯽ ﭘﺎﺳﮑﺎﻝ ﺑﻪ ﻧﺎﻡ ﺧﺪﺍ ﻧﻴﻤﺴﺎﻝ ﺩﻭﻡ 86-87 ﻣﺪﺭﺱ :ﻣﺠﺘﺒﯽ ﻧﻮﺭﯼ ﮔﺮﻭﻩ 4 ﭘﺮﻭﮊﻩ ﭘﺎﻳﺎﻥ ﺗﺮﻡ ﻧﮑﺎﺗﯽ ﺩﺭ ﻣﻮﺭﺩ ﭘﺮﻭﮊﻩ : (1ﭘﺮﻭﮊﻩ ﭘﺎﻳﺎﻧﯽ 3ﻧﻤﺮﻩ ﮐﻞ ﺭﺍ ﺩﺭﺑﺮ ﺧﻮﺍﻫﺪ ﺩﺍﺷﺖ .ﻫﻤﭽﻨﻴﻦ ﻻﺯﻡ ﺑﻪ ﺗﺬﮐﺮ ﺍﺳﺖ ﮐﻪ ﻋﺪﻡ ﺍﻧﺠﺎﻡ ﺁﻥ ﻣﺎﻧﻊ ﺍﺯ ﭘﺎﺱ ﺷﺪﻥ ﺩﺭﺱ ﻣﯽ ﮔﺮﺩﺩ .ﺑﺮﺍﻳﻦ ﺍﺳﺎﺱ ﻫﺮ ﮐﺲ ﺑﺎﻳﺪ ﻳﮑﯽ ﺍﺯ ﻣﻮﺿﻮﻋﺎﺕ ﺯﻳﺮ ﺭﺍ ﺍﻧﺘﺨﺎﺏ ﮐﻨﺪ . (2ﺍﻣﮑﺎﻥ ﮐﺎﺭ ﮔﺮﻭﻫﯽ ﻣﻮﺟﻮﺩ ﻧﻤﯽ ﺑﺎﺷﺪ ﻭ ﻫﺮ ﮐﺲ ﺑﺎﻳﺪ ﺑﻪ ﺗﻨﻬﺎﻳﯽ ﭘﺮﻭﮊﻩ ﺧﻮﺩ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﺪ . (3ﺩﺭ ﺗﺸﺮﻳﺢ ﭘﺮﻭﮊﻩ ﻫﺎ ﻣﻮﺍﺭﺩ ﺍﺻﻠﯽ ﮐﺎﺭ ﺗﻮﺿﻴﺢ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ﻭ ﺍﮔﺮ ﻣﻮﺭﺩﯼ ﺫﮐﺮ ﻧﺸﺪﻩ ،ﺑﺼﻮﺭﺕ ﺍﻧﺘﺨﺎﺑﯽ ﺍﺯ ﺟﺎﻧﺐ ﺷﻤﺎ ﻗﺎﺑﻞ ﺍﺟﺮﺍ ﻣﯽ ﺑﺎﺷﺪ . (4ﺑﺮﺍﯼ ﮐﻤﮏ ﺑﻴﺸﺘﺮ ،ﺳﻌﯽ ﻣﯽ ﺷﻮﺩ ﻳﮏ ﺟﻠﺴﻪ ﺭﻓﻊ ﺍﺷﮑﺎﻝ ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﺷﻮﺩ ﮐﻪ ﺯﻣﺎﻥ ﺁﻥ ﺍﻋﻼﻡ ﺧﻮﺍﻫﺪ ﺷﺪ .ﺑﺎ ﺍﻳﻦ ﻭﺟﻮﺩ ﺍﮔﺮ ﺩﺭ ﺣﻴﻦ ﮐﺎﺭ ﺑﻪ ﻣﺸﮑﻠﯽ ﺑﺮﺧﻮﺭﺩﻳﺪ ﻣﯽ ﺗﻮﺍﻧﻴﺪ ﺍﺯ ﻃﺮﻳﻖ emailﺳﻮﺍﻝ ﺧﻮﺩ ﺭﺍ ﻣﻄﺮﺡ ﮐﻨﻴﺪ . (5ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﺮﻭﮊﻩ ﻧﻮﺷﺘﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﺷﺨﺺ ﺩﻳﮕﺮ ﺑﻪ ﻫﺮ ﻧﺤﻮ ،ﺳﺒﺐ ﻣﯽ ﺷﻮﺩ ﻧﻪ ﺗﻨﻬﺎ ﻧﻤﺮﻩ ﭘﺮﻭﮊﻩ ﺑﻠﮑﻪ ﻧﻤﺮﻩ ﮐﻞ ﺩﺭﺱ ﺭﺍ ﺍﺯ ﺩﺳﺖ ﺑﺪﻫﻴﺪ . (6ﭘﺲ ﺍﺯ ﺍﺗﻤﺎﻡ ﮐﺎﺭ ﺗﻤﺎﻡ ﻓﺎﻳﻠﻬﺎﯼ ﺑﺮﻧﺎﻣﻪ ﺧﻮﺩ ﺭﺍ ﺩﺭ ﻳﮏ ﻓﺎﻳﻞ zipﻗﺮﺍﺭ ﺩﻫﻴﺪ )ﺍﺳﻢ ﻓﺎﻳﻞ zipﺭﺍ ﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮﻳﯽ ﺧﻮﺩ ﺑﮕﺬﺍﺭﻳﺪ( ﻭ ﺁﻥ ﺭﺍ ﺑﻪ ﺁﺩﺭﺱ pascal86.course@gmail.comﺑﻔـﺮﺳﺘﻴﺪ .ﻋﻨـﻮﺍﻥ ﺍﻳﻤﻴﻞ ﺑﺎﻳﺪ ﺑﻪ ﺻﻮﺭﺕ PRJ‐STDﺑﺎﺷﺪ) .ﺑﺠﺎﯼ STDﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮﻳﯽ ﺧﻮﺩ ﺭﺍ ﻗﺮﺍﺭ ﺩﻫﻴﺪ .ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ( PRJ‐86109605 : (7ﻣﻬﻠﺖ ﺍﺭﺳﺎﻝ ﭘﺮﻭﮊﻩ ﺗﺎ 29ﺗﻴﺮ ﻣﺎﻩ ﻣﯽ ﺑﺎﺷﺪ) .ﺯﻣﺎﻥ ﺍﺭﺍﺋﻪ ﭼﻨﺪ ﺭﻭﺯ ﺑﻌﺪ ﺍﺯ ﺁﻥ ﻣﯽ ﺑﺎﺷﺪ ﮐﻪ ﻣﺘﻌﺎﻗﺒﺎ" ﺍﻋﻼﻡ ﺧﻮﺍﻫﺪ ﺷﺪ( ﭘﺮﻭﮊﻩ ﺍﻭﻝ :ﺷﺒﻴﻪ ﺳﺎﺯﯼ ﮔﺮﺍﻓﻴﮑﯽ ﺍﮐﺴﻞ ) 4ﻧﻤﺮﻩ( ﺩﺭ ﺍﻳﻦ ﭘﺮﻭﮊﻩ ﻫﺪﻑ ﻧﻮﺷﺘﻦ ﺑﺮﻧﺎﻣﻪ ﺍﯼ ﺍﺳﺖ ﮐﻪ ﺗﺎ ﺣﺪ ﺯﻳﺎﺩﯼ ﻣﺸﺎﺑﻪ ﺍﮐﺴﻞ ﻋﻤﻞ ﻣﯽ ﮐﻨﺪ. ﺑﺪﻳﻦ ﺗﺮﺗﻴﺐ ﮐﻪ ﺷﻤﺎ ﺑﺎﻳﺪ ﻳﮏ ﺻﻔﺤﻪ ﻣﺘﺸﮑﻞ ﺍﺯ ﺗﻌﺪﺍﺩ ﺯﻳﺎﺩﯼ ﺧﺎﻧﻪ )ﻣﺜﻼ" ﺻﺪ ﺩﺭ ﺻﺪ( ﺭﺍ ﻧﻤﺎﻳﺶ ﺩﻫﻴﺪ ﮐﻪ ﺩﺭ ﻫﺮ ﻟﺤﻈﻪ ﺗﻌﺪﺍﺩﯼ ﺍﺯ ﺁﻧﻬﺎ ﺭﻭﯼ ﺻﻔﺤﻪ ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﻣﯽ ﺷﻮﻧﺪ )ﺑﺴﺘﻪ ﺑﻪ ﺍﻧﺪﺍﺯﻩ ﺍﯼ ﮐﻪ ﺷﻤﺎ ﺑﺮﺍﯼ ﻫﺮ ﺧﺎﻧﻪ ﺩﺭ ﻧﻈﺮ ﻣﯽ ﮔﻴﺮﻳﺪ( ﻫﻤﭽﻨﻴﻦ ﺩﺭ ﻫﺮ ﻟﺤﻈﻪ ﻳﮑﯽ ﺍﺯ ﺧﺎﻧﻪ ﻫﺎ ﺑﺎﻳﺪ ﺑﺎ ﺭﻧﮓ ﺩﻳﮕﺮﯼ ﻣﺘﻤﺎﻳﺰ ﺑﺎﺷﺪ ﮐﻪ ﺑﻴﺎﻧﮕﺮ ﻓﻌﺎﻝ ﺑﻮﺩﻥ ﺁﻥ ﺧﺎﻧﻪ ﻣﯽ ﺑﺎﺷﺪ. ﮐﺎﺭﺑﺮ ﺑﺎﻳﺪ ﺑﺘﻮﺍﻧﺪ ﺑﻮﺳﻴﻠﻪ ﮐﻠﻴﺪﻫﺎﯼ ﺑﺎﻻ ،ﭘﺎﻳﻴﻦ ،ﭼﭗ ،ﺭﺍﺳﺖ ﺑﻴﻦ ﺧﺎﻧﻪ ﻫﺎ ﺟﺎﺑﺠﺎ ﺷﻮﺩ ﻭ ﺧﺎﻧﻪ ﻓﻌﺎﻝ ﺭﺍ ﺗﻐﻴﻴﺮ ﺩﻫﺪ .ﺍﮔﺮ ﺑﻪ ﺍﻧﺘﻬﺎﯼ ﺳﺘﻮﻥ ﺧﺎﻧﻪ ﻫﺎ ﺩﺭ ﺻﻔﺤﻪ ﺭﺳﻴﺪ ﮐﻞ ﺧﺎﻧﻪ ﻫﺎ ﺑﺎﻳﺪ ﻳﮏ ﻭﺍﺣﺪ ﺟﺎﺑﺠﺎ ﺷﻮﻧﺪ ﻭ ﺧﺎﻧﻪ ﺑﻌﺪﯼ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﺷﻮﺩ ﻭ ﻓﻌﺎﻝ ﮔﺮﺩﺩ .ﻣﺜﻼ" ﻓﺮﺽ ﮐﻨﻴﺪ ﮐﻪ ﺩﺭ ﻫﺮ ﺳﻄﺮ 20ﺧﺎﻧﻪ ﺩﺭ ﺻﻔﺤﻪ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻭﻟﯽ ﮐﻞ ﺧﺎﻧﻪ ﻫﺎﯼ ﻫﺮ ﺳﻄﺮ 100ﺗﺎﺳﺖ .ﺧﻮﺏ ﻭﺍﺿﺢ ﺍﺳﺖ ﮐﻪ ﺩﺭ ﺍﺑﺘﺪﺍﯼ ﺍﺟﺮﺍﯼ ﺑﺮﻧﺎﻣﻪ ﺑﻴﺴﺖ ﺧﺎﻧﻪ ﺍﻭﻝ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﯽ ﺷﻮﻧﺪ .ﺣﺎﻝ ﺍﮔﺮ ﮐﺎﺭﺑﺮ ﺑﺎ ﮐﻠﻴﺪ ﺭﺍﺳﺖ ﺑﻴﻦ ﺳﺘﻮﻧﻬﺎ ﺟﺎﺑﺠﺎ ﺷﻮﺩ ﻭ ﺑﻪ ﺧﺎﻧﻪ ﺑﻴﺴﺘﻢ ﺑﺮﺳﺪ ،ﺑﺎﺭ ﺑﻌﺪﯼ ﮐﻪ ﺍﺯ ﮐﻠﻴﺪ ﺭﺍﺳﺖ ﺍﺳﺘﻔﺎﺩﻩ ﻣﯽ ﮐﻨﺪ ﮐﻠﻴﻪ ﺧﺎﻧﻪ ﻫﺎ ﻳﮑﯽ ﺟﺎﺑﺠﺎ ﻣﯽ ﺷﻮﻧﺪ ﻭ ﺩﺭ ﻣﻮﻗﻌﻴﺖ ﺟﺪﻳﺪ ﺧﺎﻧﻪ ﻫﺎﯼ 2ﺗﺎ 21ﺭﻭﯼ ﺻﻔﺤﻪ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﻣﯽ ﺷﻮﻧﺪ .ﺍﻳﻦ ﮐﺎﺭ ﺗﺎ ﺯﻣﺎﻧﯽ ﮐﻪ ﺧﺎﻧﻪ ﺩﻳﮕﺮﯼ ﻧﺒﺎﺷﺪ ﻗﺎﺑﻞ ﺍﺟﺮﺍﺳﺖ .ﻫﻤﻴﻦ ﻣﺴﺌﻠﻪ ﺩﺭ ﺟﻬﺖ ﻋﻤﻮﺩﯼ ﻧﻴﺰ ﺑﺮﻗﺮﺍﺭ ﻣﯽ ﺑﺎﺷﺪ. ﺧﺎﻧﻪ ﻫﺎﯼ ﺍﻳﻦ ﺍﮐﺴﻞ ﺑﺎﻳﺪ ﻫﻤﺎﻧﻨﺪﺍﮐﺴﻞ ﻭﺍﻗﻌﯽ ﻧﺎﻣﮕﺬﺍﺭﯼ ﺷﻮﻧﺪ ﻭ ﺩﺭ ﺑﺎﻻ ﻭ ﭼﭗ ﺻﻔﺤﻪ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﻮﻧﺪ) .ﺧﺎﻧﻪ ﺍﻭﻝ ﺑﺎ ﺣﺮﻑ A ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﻮﺩ ﻭ (...ﺍﻳﻦ ﻧﺎﻣﮕﺬﺍﺭﯼ ﻭ ﻧﺤﻮﻩ ﻧﻤﺎﻳﺶ ﺭﺍ ﺩﻗﻴﻘﺎ" ﺑﺎﻳﺪ ﻣﺸﺎﺑﻪ ﺍﮐﺴﻞ ﺍﻋﻤﺎﻝ ﮐﻨﻴﺪ. ﺍﻳﻦ ﺑﺮﻧﺎﻣﻪ ﺑﺎﻳﺪ ﻳﮏ ﺧﻂ ﻓﺮﻣﺎﻥ ﻧﻴﺰ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﮐﻪ ﺩﺭ ﺁﻥ ﮐﺎﺭﺑﺮ ﻣﯽ ﺗﻮﺍﻧﺪ ﻳﮏ ﻋﺪﺩ ﻳﺎ ﻓﺮﻣﺎﻥ ﺭﺍ ﻭﺍﺭﺩ ﮐﻨﺪ ﮐﻪ ﺟﻮﺍﺏ ﺑﺎﻳﺪ ﺩﺭ ﺧﺎﻧﻪ ﻓﻌﺎﻝ ﻗﺮﺍﺭ ﮔﻴﺮﺩ ﻭ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﺷﻮﺩ .ﻓﺮﻣﺎﻥ ﻫﺎﻳﯽ ﮐﻪ ﮐﺎﺭﺑﺮ ﻣﯽ ﺗﻮﺍﻧﺪ ﻭﺍﺭﺩ ﮐﻨﺪ 4ﺩﺳﺘﻮﺭ sum,average,max,min ﻣﯽ ﺑﺎﺷﺪﮐﻪ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﻗﺎﺑﻞ ﺍﺳﺘﻔﺎﺩﻩ ﻣﯽ ﺑﺎﺷﻨﺪ : Sum(B1:B4) or average(A6:A10) or max(C3:C74) ﻫﻤﺎﻧﻄﻮﺭ ﮐﻪ ﻣﯽ ﺑﻴﻨﻴﺪ ﺍﻳﻦ ﺩﺳﺘﻮﺭﻫﺎ ﺩﻗﻴﻘﺎ" ﻣﺎﻧﻨﺪ ﺍﮐﺴﻞ ﻭﺍﻗﻌﯽ ﻧﻮﺷﺘﻪ ﻣﯽ ﺷﻮﻧﺪ ﻭ ﺑﻪ ﻫﻤﺎﻥ ﻃﺮﻳﻖ ﻧﻴﺰ ﻣﺤﺎﺳﺒﻪ ﻣﯽ ﮔﺮﺩﻧﺪ. ﺟﻮﺍﺏ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻫﺎ ﺑﺎﻳﺪ ﺩﺭ ﺧﺎﻧﻪ ﻓﻌﺎﻝ ﺣﺎﻓﻈﻪ ﻗﺮﺍﺭ ﮔﻴﺮﺩ. ﻃﺮﺍﺣﯽ ﺻﻔﺤﻪ ﺍﮐﺴﻞ ﮐﺎﻣﻼ" ﺳﻠﻴﻘﻪ ﺍﯼ ﺑﻮﺩﻩ ﻭ ﻓﻘﻂ ﺑﺎﻳﺪ ﻣﻮﺍﺭﺩ ﺧﻮﺍﺳﺘﻪ ﺷﺪﻩ ﺭﺍ ﺩﺭ ﺑﺮ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ. ﺍﻣﮑﺎﻧﺎﺕ ﺍﺧﺘﻴﺎﺭﯼ ﺍﻳﻦ ﻣﻮﺍﺭﺩ ﺗﻤﺎﻣﺎ" ﺟﻨﺒﻪ ﺍﺿﺎﻓﯽ ﺩﺍﺭﻧﺪ ﻭ ﺑﺴﺘﻪ ﺑﻪ ﻧﻮﻉ ﺁﻧﻬﺎ ﻭ ﻧﺤﻮﻩ ﺍﺟﺮﺍﯼ ﺷﻤﺎ ﻧﻤﺮﻩ ﻣﺎﺯﺍﺩ ﺧﻮﺍﻫﻨﺪ ﺩﺍﺷﺖ : (1ﻣﺤﺎﺳﺒﻪ ﺗﻮﺍﺑﻊ ﺩﻳﮕﺮﯼ ﭼﻮﻥ sin,cos,exp,log,...ﻭ ﻗﺮﺍﺭ ﺩﺍﺩﻥ ﺩﺭ ﺧﺎﻧﻪ ﻓﻌﺎﻝ (2ﻣﺤﺎﺳﺒﻪ ﺗﺮﮐﻴﺒﯽ ﺗﻮﺍﺑﻊ ﮐﻪ ﺷﺎﻣﻞ ﻫﺮﮔﻮﻧﻪ ﻋﻤﻠﻴﺎﺕ ﺟﺒﺮﯼ ﺭﻭﯼ ﺗﻮﺍﺑﻊ ﻣﯽ ﺑﺎﺷﺪ . )ﻣﺜﺎﻝ ( sum(B1:B4)+average(A6:A10) : (3ﺍﻣﮑﺎﻥ SAVE , LOADﺑﺮﻧﺎﻣﻪ (4ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻣﺎﻭﺱ (5ﻗﺮﺍﺭ ﺩﺍﺩﻥ ﻣﻨﻮ ﺑﺮﺍﯼ ﺑﺮﻧﺎﻣﻪ (6ﻫﺮ ﺗﻮﺍﻧﺎﻳﯽ ﻣﺎﺯﺍﺩ ﺩﻳﮕﺮ ﺑﺴﺘﻪ ﺑﻪ ﺩﻟﺨﻮﺍﻩ ﺷﻤﺎ )ﺑﻪ ﺗﻨﺎﺳﺐ ﺍﻣﺘﻴﺎﺯﺩﻫﯽ ﺧﻮﺍﻫﺪ ﺷﺪ( ﭘﺮﻭﮊﻩ ﺩﻭﻡ :ﺑﺎﺯﯼ ﺑﺎ ﻋﺒﺎﺭﺍﺕ ﺭﻳﺎﺿﯽ ) 3ﻧﻤﺮﻩ( ﺩﺭ ﻳﮏ ﻓﺎﻳﻞ ﻭﺭﻭﺩﯼ ﺑﻪ ﻧﺎﻡ Input.txtﺩﺳﺘﻮﺭﺍﺗﯽ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﮐﻪ ﺷﻤﺎ ﺑﺎﻳﺪ ﭘﺲ ﺍﺯ ﺁﻧﺎﻟﻴﺰ ﺁﻧﻬﺎ ﺟﻮﺍﺑﻬﺎﯼ ﻻﺯﻡ ﺭﺍ ﺩﺭ ﻓﺎﻳﻞ Output.txtﻗﺮﺍﺭ ﺩﻫﻴﺪ .ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺑﻪ ﺩﻭ ﺑﺨﺶ ﻣﺤﺎﺳﺒﺎﺗﯽ ﻭ ﻧﻤﺎﻳﺸﯽ ﺗﻘﺴﻴﻢ ﻣﯽ ﮔﺮﺩﻧﺪ : (1ﺩﺳﺘﻮﺭﺍﺕ ﻣﺤﺎﺳﺒﺎﺗﯽ : ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺑﻪ ﺩﻭ ﻓﺮﻣﺖ ﮐﻠﯽ ﺯﻳﺮ ﻣﯽ ﺑﺎﺷﻨﺪ : Name1 N1 Operator1 N2 Operator2 N3 Operator3 N4 Swap N1 N2 ﺩﺭ ﻓﺮﻣﺖ ﺍﻭﻝ Name1ﻧﺎﻡ ﻣﺘﻐﻴﺮﯼ ﺍﺳﺖ ﮐﻪ ﻗﺮﺍﺭ ﺍﺳﺖ ﺣﺎﺻﻞ ﻋﺒﺎﺭﺕ ﻣﺤﺎﺳﺒﻪ ﺷﺪﻩ )ﺑﻪ ﺻﻮﺭﺕ ﻳﮏ ﭼﻨﺪﺟﻤﻠﻪ ﺍﯼ ﺑﺎ ﻣﺘﻐﻴﺮ (xﺩﺭﺁﻥ ﻗﺮﺍﺭ ﮔﻴﺮﺩ. ﺍﭘﺮﺍﺗﻮﺭﻫﺎ ﺷﺎﻣﻞ ﻳﮑﯽ ﺍﺯ ﻋﻼﻣﺎﺕ * ‐ , + , ﻣﯽ ﺑﺎﺷﻨﺪ ﻭ N1,N2,N3,N4ﻣﯽ ﺗﻮﺍﻧﻨﺪ ﻣﺘﻐﻴﺮﯼ ﺍﺯ ﭘﻴﺶ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ، ﻳﮏ ﻋﺪﺩ ﻭ ﻳﺎ ﺧﻮﺩ xﺑﺎﺷﻨﺪ) .ﺑﻴﻦ ﺍﭘﺮﺍﺗﻮﺭﻫﺎ ﻭ ﻣﺘﻐﻴﺮﻫﺎ ﻳﮏ ﻓﻀﺎﯼ ﺧﺎﻟﯽ ﻭﺟﻮﺩ ﺩﺍﺭﺩ( ﻻﺯﻡ ﺑﻪ ﺫﮐﺮ ﺍﺳﺖ ﮐﻪ ﺩﺭ ﻣﺤﺎﺳﺒﻪ ﻋﺒﺎﺭﺕ ﻣﺮﺑﻮﻃﻪ ﺑﺎﻳﺪ ﺍﻭﻟﻮﻳﺖ ﺍﭘﺮﺍﺗﻮﺭﻫﺎ ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ. ﭘﺲ ﺩﺭ ﻧﻬﺎﻳﺖ ﻫﺮ ﻣﺘﻐﻴﺮ ﺑﺮﺍﺑﺮ ﻳﮏ ﭼﻨﺪﺟﻤﻠﻪ ﺍﯼ ﺍﺳﺖ ﮐﻪ ﺷﻤﺎ ﺑﺎﻳﺪ ﺁﻥ ﺭﺍ ﺑﻪ ﻫﺮ ﻧﺤﻮ ﺫﺧﻴﺮﻩ ﮐﻨﻴﺪ. ﺩﺭ ﻓﺮﻣﺖ ﺩﻭﻡ ﺩﺳﺘﻮﺭ ﺳﺒﺐ ﺟﺎﺑﺠﺎﻳﯽ ﺭﻭﺍﺑﻂ ﭼﻨﺪﺟﻤﻠﻪ ﺍﯼ N1 , N2ﻣﯽ ﮔﺮﺩﺩ. ﺑﻪ ﻧﻤﻮﻧﻪ ﺍﯼ ﺍﺯ ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺗﻮﺟﻪ ﮐﻨﻴﺪ : Temp1 1 + x * 2 Temp2 Temp1 * 2 Temp3 Temp1 + x * Temp2 – 3 Swap Temp1 Temp2 ﺩﺭ ﺍﻭﻟﻴﻦ ﺧﻂ ﺍﺑﺘﺪﺍ ﻣﺘﻐﻴﺮ Temp1ﺗﻌﺮﻳﻒ ﻣﯽ ﺷﻮﺩ ﻭ ﻣﻘﺪﺍﺭ ﺁﻥ ﺑﺮﺍﺑﺮ 2x+1ﻗﺮﺍﺭ ﻣﯽ ﮔﻴﺮﺩ .ﺳﭙﺲ ﻣﺘﻐﻴﺮ Temp2 ﺑﺼﻮﺭﺕ ﺩﻭ ﺑﺮﺍﺑﺮ (Temp2=4x+2) Temp1ﺗﻌﺮﻳﻒ ﻣﯽ ﺷﻮﺩ ﻭ ﻧﻬﺎﻳﺘﺎ" Temp3ﺑﺮﺍﺑﺮ 4x^2+4x‐2ﻗﺮﺍﺭ ﻣﯽ ﮔﻴﺮﺩ. ﭘﺲ ﺍﺯ ﺍﺟﺮﺍﯼ ﺧﻂ ﭼﻬﺎﺭﻡ Temp1=4x+2 , Temp2=2x+1 ،ﻣﯽ ﮔﺮﺩﺩ. (2ﺩﺳﺘﻮﺭﺍﺕ ﻧﻤﺎﻳﺸﯽ : ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺑﻪ ﺳﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﻣﯽ ﺑﺎﺷﻨﺪ : Show Name Calc Name Numeber IsEqual Name1 Name2 ﺩﺳﺘﻮﺭ Showﺭﺍﺑﻄﻪ ﭼﻨﺪﺟﻤﻠﻪ ﺍﯼ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺘﻐﻴﺮ nameﺭﺍ ﻧﺸﺎﻥ ﻣﯽ ﺩﻫﺪ .ﺩﺳﺘﻮﺭ Calcﻣﻘﺪﺍﺭ ﻋﺪﺩ ﺍﻋﺸﺎﺭﯼ Numberﺭﺍ ﺑﺠﺎﯼ xﺩﺭ ﺭﺍﺑﻄﻪ ﭼﻨﺪﺟﻤﻠﻪ ﺍﯼ nameﻗﺮﺍﺭ ﺩﺍﺩﻩ ،ﺣﺎﺻﻞ ﺭﺍ ﻣﯽ ﻳﺎﺑﺪ .ﺩﺳﺘﻮﺭ IsEqualﺍﮔﺮ ﺭﺍﺑﻄﻪ ﭼﻨﺪﺟﻤﻠﻪ ﺍﯼ ﺩﻭ ﻣﺘﻐﻴﺮ Name1,Name2ﻳﮑﺴﺎﻥ ﺑﻮﺩ ،ﺩﺭﺧﺮﻭﺟﯽ ﮐﻠﻤﻪ ” “yesﻭ ﺩﺭ ﻏﻴﺮ ﺍﻳﻨﺼﻮﺭﺕ ﮐﻠﻤﻪ ” “noﺭﺍ ﭼﺎﭖ ﻣﯽ ﮐﻨﺪ. ﻧﮑﺎﺕ : • ﺩﺭ ﻓﺎﻳﻞ ﻭﺭﻭﺩﯼ Input.txtﻫﻢ ﺩﺳﺘﻮﺭﺍﺕ ﻣﺤﺎﺳﺒﺎﺗﯽ ﻭ ﻫﻢ ﺩﺳﺘﻮﺭﺍﺕ ﻧﻤﺎﻳﺸﯽ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ .ﻭﻟﯽ ﺑﻪ ﺍﺯﺍﯼ ﻫﺮ ﺩﺳﺘﻮﺭ ﻧﻤﺎﻳﺸﯽ ﻳﮏ ﺧﻂ ﺟﻮﺍﺏ ﺩﺭ ﻓﺎﻳﻞ ﺧﺮﻭﺟﯽ Output.txtﭼﺎﭖ ﻣﯽ ﮔﺮﺩﺩ . • ﻫﺮ ﭼﻨﺪ ﺟﻤﻠﻪ ﺍﯼ ﺭﺍ ﺣﺪﺍﮐﺜﺮ ﺗﺎ ﺩﺭﺟﻪ 20ﺗﻌﺮﻳﻒ ﻣﯽ ﮐﻨﻴﻢ . • ﺍﺯ ﻋﻼﻣﺖ ﺿﺮﺏ ﺩﺭ ﻧﻤﺎﻳﺶ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﯽ ﺷﻮﺩ .ﺑﺮﺍﯼ ﻣﺜﺎﻝ ﻋﺒﺎﺭﺕ 2x+2ﺭﺍ ﻧﺒﺎﻳﺪ ﺑﺼﻮﺭﺕ 2*x+2ﻧﻮﺷﺖ . • ﺩﺭ ﭼﺎﭖ ﻣﻌﺎﺩﻻﺕ ﺟﺒﺮﯼ ﺑﺎﻳﺪ ﻫﻤﻴﺸﻪ ﺗﺮﻣﯽ ﮐﻪ ﺩﺭﺟﻪ ﺑﻴﺸﺘﺮ ﺩﺍﺭﺩ ﺭﺍ ﺯﻭﺩﺗﺮ ﭼﺎﭖ ﮐﻨﺪ .ﺑﺮﺍﯼ ﻣﺜﺎﻝ ﻋﺒﺎﺭﺕ 2x^2+2x ﻫﺮﮔﺰ ﺑﺼﻮﺭﺕ 2x+2x^2ﭼﺎﭖ ﻧﻤﯽ ﮔﺮﺩﺩ . • ﻫﺮ ﺩﻭ ﻓﺎﻳﻞ ﻭﺭﻭﺩﯼ ﻭ ﺧﺮﻭﺟﯽ ﻣﺘﻨﯽ ﻫﺴﺘﻨﺪ . • ﺩﺳﺘﻮﺭﺍﺕ ﺑﺼﻮﺭﺕ ﺣﺮﻭﻑ ﺑﺰﺭﮒ ﻭ ﮐﻮﭼﮏ ﻳﮑﺴﺎﻥ ﻣﯽ ﺑﺎﺷﻨﺪ) .ﺑﺮﺍﯼ ﻣﺜﺎﻝ isEQUALﺑﺎ IsEqualﻳﮑﺴﺎﻥ ﺍﺳﺖ( • ﺗﻨﻬﺎ ﻣﺘﻐﻴﺮﯼ ﮐﻪ ﺩﺭ ﺗﻌﺎﺭﻳﻒ ﻗﺎﺑﻞ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺳﺖ xﻣﯽ ﺑﺎﺷﺪ ﻭ ﻣﺘﻐﻴﺮﻫﺎﻳﯽ ﻧﻈﻴﺮ … y , z , ﻭﺟﻮﺩ ﻧﺪﺍﺭﻧﺪ . • ﺩﺭ ﻧﻤﺎﻳﺶ ﻋﺒﺎﺭﺍﺕ ﺟﺒﺮﯼ ﻫﻤﻴﺸﻪ ﺩﺭ ﺩﻭ ﻃﺮﻑ ﻋﻤﻠﮕﺮ ﺟﻤﻊ ﻭ ﺗﻔﺮﻳﻖ ﻳﮏ ﻓﺎﺻﻠﻪ ﻗﺮﺍﺭ ﺩﻫﻴﺪ ﻭﻟﯽ ﺩﺭ ﺍﻃﺮﺍﻑ ﻋﻤﻠﮕﺮ ﺗﻮﺍﻥ ﻫﻴﭻ ﻓﺎﺻﻠﻪ ﺍﯼ ﻧﮕﺬﺍﺭﻳﺪ ).ﺷﮑﻞ ﺻﺤﻴﺢ 2x^2 + 2x :؛ ﺷﮑﻞ ﻏﻠﻂ (2x ^ 2+2 x : ﻧﻤﻮﻧﻪ ﺍﯼ ﺍﺯ ﻳﮏ ﻓﺎﻳﻞ ﻭﺭﻭﺩﯼ : Temp1 1 + x * 2 Temp2 Temp1 * 2 SHOW Temp2 Calc Temp1 ‐1.2 Temp3 Temp1 + x * Temp2 – 3 isequal Temp2 Temp3 ﻧﻤﻮﻧﻪ ﻓﺎﻳﻞ ﺧﺮﻭﺟﯽ ﺍﻳﻦ ﻭﺭﻭﺩﯼ : 4x + 2 ‐1.4 no
© Copyright 2025 Paperzz