🔒 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
  • 711
    Views
  • 6
    Participants
Last reply from:
PadrePatatas

Trending Topics

Online now

Members online
1,126
Guests online
1,104
Total visitors
2,230

Forum statistics

Threads
2,287,147
Posts
29,042,632
Members
1,216,389
Latest member
wadawd
Back
Top