Telegram Group & Telegram Channel
سادساً : معاملات الإزاده والانقاص

👈هناك دائماً حاجة في البرمجة إلى زيادة 1 أو طرح 1 . هذه الحالات شائعة لدرجة أن C++ تتضمن عاملين خاصين ينفذان هذه المهمة، يقوم عامل التناقص (--) بطرح 1 من المتغير ويضيف عامل التزايد (++) 1 إليه ، المثال الآتي يبين طريقة الاستعمال:-
++a
a++
معناه إضافة 1 إلى a، ويمكن كتابته بصورة مكافئة على النحو a=a+1 وبالطريقة نفسها يمكن إنقاص 1 من قيمة a على النحو --a أو a-- وهو يكافئ a=a-1.
ومما يجب التنبيه إليه هنا أن هنالك فرق بين ++ a أو a++ فعلى الرغم من كليهما يجمع 1 إلى a إلا أنه عند استعمال ++a تستخرج قيمة التعبير باستعمال قيمة a الحالية قبل زيادتها وينطبق هذا أيضاً على --a وa-- .


#include<iostream.h>
main ( )
{
int c;
c = 5;
cout << c << endl;
cout << c++ <<endl;
cout << c <<endl;
c=5;
cout << c << endl << endl;
cout << ++c << endl;
cout << c << endl;
return 0;
//Continued
}

الخرج من البرنامج:
5
5
6

5
6
6

🖋 م . أحمد قطران

انتهى ....



tg-me.com/Beprogramming/1389
Create:
Last Update:

سادساً : معاملات الإزاده والانقاص

👈هناك دائماً حاجة في البرمجة إلى زيادة 1 أو طرح 1 . هذه الحالات شائعة لدرجة أن C++ تتضمن عاملين خاصين ينفذان هذه المهمة، يقوم عامل التناقص (--) بطرح 1 من المتغير ويضيف عامل التزايد (++) 1 إليه ، المثال الآتي يبين طريقة الاستعمال:-
++a
a++
معناه إضافة 1 إلى a، ويمكن كتابته بصورة مكافئة على النحو a=a+1 وبالطريقة نفسها يمكن إنقاص 1 من قيمة a على النحو --a أو a-- وهو يكافئ a=a-1.
ومما يجب التنبيه إليه هنا أن هنالك فرق بين ++ a أو a++ فعلى الرغم من كليهما يجمع 1 إلى a إلا أنه عند استعمال ++a تستخرج قيمة التعبير باستعمال قيمة a الحالية قبل زيادتها وينطبق هذا أيضاً على --a وa-- .


#include<iostream.h>
main ( )
{
int c;
c = 5;
cout << c << endl;
cout << c++ <<endl;
cout << c <<endl;
c=5;
cout << c << endl << endl;
cout << ++c << endl;
cout << c << endl;
return 0;
//Continued
}

الخرج من البرنامج:
5
5
6

5
6
6

🖋 م . أحمد قطران

انتهى ....

BY مستـ1ــوى حاسوب


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/Beprogramming/1389

View MORE
Open in Telegram


مستـ1ــوى حاسوب Telegram | DID YOU KNOW?

Date: |

Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.

Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.

مستـ1ــوى حاسوب from us


Telegram مستـ1ــوى حاسوب
FROM USA