C++ for loops explained 🔂

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 28

  • @BroCodez
    @BroCodez  2 года назад +25

    #include

    int main()
    {
    for(int i = 10; i > 0; i--){
    //count down to 10
    std::cout

  • @crooda3681
    @crooda3681 7 месяцев назад +16

    Happy new year

  • @criminalx7099
    @criminalx7099 2 года назад +7

    It reduces line of codes.

  • @rivazmardani
    @rivazmardani 2 года назад +1

    mantab jiwa

  • @c0ola1d
    @c0ola1d 2 года назад +18

    #include
    int main(){
    int count = 0;
    char yorn;
    std::string name[50];
    do{
    std::cout > name[count];
    std::cout

  • @Gavin_NA
    @Gavin_NA 5 месяцев назад +1

    #include
    #include
    int main()
    {
    for (int i = 1; i

  • @Nati-uu4ph
    @Nati-uu4ph 5 месяцев назад +2

    #include
    int main(){
    for(int i=10; i >= 1; i--){
    std::cout

  • @ins4nutty341
    @ins4nutty341 3 месяца назад +2

    Quite don't understand the initialization statement can you help me whats the counter means

    • @yashraj52_
      @yashraj52_ 3 месяца назад

      can you describe more clearly what you didn't understood. I can help you.

  • @epickite6459
    @epickite6459 14 дней назад

    im confused by the way you say less than and type ">" since its supposed to be greater than. I was also confused by the second statement on the for loop is for "Stopping condition" But you used it more like a "run the code while true" instead of a condition to be met, it is a condition to be maintained true for the code to run repeatedly. Please, am I not getting something?

  • @Chemhandle787
    @Chemhandle787 Месяц назад +1

    Think he wanted to while 10 is greater than or equal to =0. 10 was I in the code but yeah.

  • @yellowhellow-wi9gi
    @yellowhellow-wi9gi 4 месяца назад +1

    thank you

  • @sohungry9000
    @sohungry9000 2 месяца назад

    int main(){
    std::string weekDays[7] = {"Monday
    ", "Tuesday
    ", "Wednesday
    ", "Thursday
    ", "Friday
    ", "Saturday
    ", "Sunday
    "};
    int input;
    for (int i = 0; i < 7; i++){
    std::cout

  • @lastwaveundergroundsaviour7037
    @lastwaveundergroundsaviour7037 2 года назад +1

    How come the stopping condition has to be less than and equal? I used just equal and it infinitely looped it. Why is this?

    • @oximas-oe9vf
      @oximas-oe9vf 2 года назад +1

      i don'tget why it infenetly looped for you
      but the reason why you set it to less than or equal is because the for loop keeps going as long as the condition (i

  • @znedj
    @znedj 3 месяца назад

    Thanks.

  • @Yousif_Maksabo
    @Yousif_Maksabo 5 месяцев назад

    #include
    int main () {
    for (int i=10; i>=1; i-- ) {
    std::cout

  • @parpaperchimp
    @parpaperchimp 10 месяцев назад +1

    #include
    int main(){
    For(int i =0;i>= 0;i-=2)
    std::cout>>”this doesn’t even display something”\’n’;
    //this literally doesn’t do anything I wrote this as an assignment
    return 0;}

    • @krustykunal402
      @krustykunal402 9 месяцев назад

      you forgot curly bracket
      For(int i =0;i>= 0;i-=2){
      std::cout>>”this doesn’t even display something”\’n’;
      }

    • @parpaperchimp
      @parpaperchimp 9 месяцев назад

      @@krustykunal402 thanks man

  • @JayChit
    @JayChit 8 месяцев назад +2

    int main(){
    for(int i = 3; i > 0; i--){
    std::cout

  • @Lokvie
    @Lokvie 4 месяца назад

    You're such a huge help
    my try:
    #include
    #include
    int main() {
    for (int i = 1; i