C++ 'for each' loop explained 🗂️

Поделиться
HTML-код
  • Опубликовано: 18 май 2024
  • #foreach #loop
    How to iterate over an array using a foreach loop in C++ tutorial example explained
  • НаукаНаука

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

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

    #include
    int main()
    {
    // foreach loop = loop that eases the traversal over an
    // iterable data set
    int grades[] = {65, 72, 81, 93};
    for(int grade : grades){
    std::cout

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

    I like your C++ videos but I want to ask If you will do C++ GUI videos.

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

    I really like your C++ series. Keep it up. Please make more C++ Videos. So, let's defeat the RUclips algorithm.

  • @crispy498
    @crispy498 2 года назад +2

    very simple, thanks

  • @C__Plush_Plush____
    @C__Plush_Plush____ Год назад +2

    #include
    using namespace std;
    int main()
    {
    int grades[] = {65, 72, 81, 93};
    for(int grades : grades) {
    cout

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

    No bullshit
    To the point explanation
    I was midway of a course and needed to learn foreach loop fastly
    Also, i liked how you set the range of iteration in for loop using sizeofarray/sizeof1stElement
    Thank You very much

  • @lalkad8561
    @lalkad8561 Год назад

    #include
    int main(){
    // foreach loop = loop that eases traversal over an iterable data set
    // std::string students[] = {"Rudeus", "Sylphiette", "Eris", "Ghislaine"};
    int grades[] = {99, 83, 59, 78};
    for(int grade : grades){
    std::cout

  • @artemzakharchuk2842
    @artemzakharchuk2842 9 месяцев назад +1

    #include
    #include
    #include
    using namespace std;
    int main() {
    string names[] = {"Artem", "Eva", "Yula", "Nikita", "Lesha", "Dima", "Bogdan", "Lisa"};
    for(string name : names) {
    cout

    • @dazai826
      @dazai826 Месяц назад

      only iostream needed

  • @dipeshjaiswal5096
    @dipeshjaiswal5096 Год назад +3

    #include
    #include
    int main(){
    vector numbers {100,99,98};
    for(auto num:numbers)
    cout

    • @panxel8615
      @panxel8615 7 месяцев назад

      you failed. its std::vector. vector comes from the std namespace bucko

  • @KurtisHoi4
    @KurtisHoi4 8 месяцев назад

    #include
    using namespace std;
    int main() {
    cout

  • @user-vq4ld9qr5k
    @user-vq4ld9qr5k 8 месяцев назад

    #include
    int main(){
    std::string inhabitantsofthevillage[] = {"mark", "melissa", "jason","steve jobs"};
    for(std::string inhabitant : inhabitantsofthevillage){
    std::cout

  • @wlsedlacek
    @wlsedlacek Год назад

    std::string countries[] = {"Germany", "Netherlands", "Italy"};
    for(std::string country : countries){
    std::cout

  • @ali.alsjad1
    @ali.alsjad1 7 месяцев назад

    #include
    int main()
    {
    int i = 0;
    std::string names[] = { "ali","ahmad","abudalah","toga" };
    for (std::string name: names)
    {
    std::cout