🔒 Closed For loop to while loop

Status
Not open for further replies.
pag hiwa-hiwalayin nyo lang po yung initialization, condition, at pag increment
Code:
int x = 0, n = 10;
while (x < n) {
    //...
    int y = 0;
    while (y < x){
        //...
        y++;
    }
    x++;
}
 
Payo lang sa mga baguhan sa C++, mas magandang gamitin ang pre-increment(++y) kesa sa post-increment(y++) kung nasa single statement lang ito o hindi kasali sa any equation/evalution.

Code:
int x = 0, n = 10;
while (x < n) {
    //...
    int y = 0;
    while (y < x){
        //...
        ++y;  // pre-increment here
    }
    ++x;  // pre-increment here
}
 
Status
Not open for further replies.

About this Thread

  • 7
    Replies
  • 704
    Views
  • 6
    Participants
Last reply from:
PadrePatatas

Online now

Members online
1,055
Guests online
1,734
Total visitors
2,789

Forum statistics

Threads
2,275,244
Posts
28,961,735
Members
1,232,672
Latest member
kerwindl
Back
Top