SubhanXd
Centipat
- Katılım
- 5 Kasım 2022
- Mesajlar
- 151
Peki meselaİkisi de arttırma işlemi ama şöyle çalışıyor.
int a = 5;
int b = ++a;
dersek a = 6, b = 6 olur.
Yani a değişkenini önceden artırıyor. O yüzden b değeri 6 oluyor.
int a = 5;
int b = a++;
dersek eğer a = 6, b = 5 olur.
Yani a değişkenini sonrada artırıyor. O yüzden b değeri 5 oluyor.
Given the following program:
int main() {
int a = 1;
cout << ++a + a++ << endl;
cout << a << endl;
}
Predict the output of the program and explain the result.
Burda ne yapmak lazım?