C++ search an array for an element 🔎

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • #array #search #element
    C++ linear search tutorial example explained

КОМЕНТАРІ • 16

  • @BroCodez
    @BroCodez  2 роки тому +8

    #include
    int searchArray(std::string array[], int size, std::string element);
    int main()
    {
    std::string foods[] = {"pizza", "hamburger", "hotdog"};
    int size = sizeof(foods)/sizeof(foods[0]);
    int index;
    std::string myFood;
    std::cout

  • @lue224
    @lue224 2 роки тому +1

    A Multiplatform GUI with c++ tutorial would be really cool. For example, the qt framework

  • @criminalx7099
    @criminalx7099 2 роки тому +3

    well explained bro

  • @Yousif_Maksabo
    @Yousif_Maksabo 2 місяці тому +2

    My Assignment:
    #include
    double average(double grades[], int numGrades);
    int main () {
    double grades[] = {93,100,98,100,100,100};
    int numGrades = sizeof(grades)/sizeof(grades[0]);
    double averageGrade = average(grades, numGrades);

    std::cout

  • @artemzakharchuk2842
    @artemzakharchuk2842 10 місяців тому +1

    Great explanation,brooooooooo)

  • @hupmitom5509
    @hupmitom5509 Рік тому

    very nice

  • @maxwong1768
    @maxwong1768 8 днів тому

    Search for existence and index of a specific element in array of any data type
    template
    int SearchArr(T arr[], int arrSize, T targ){
    for (int i = 0 ; i

  • @miumiu124
    @miumiu124 2 місяці тому

    What if I want a -1 in my array?

  • @Boogie-wi7hd
    @Boogie-wi7hd 9 місяців тому +1

    not working for me :(

    • @studysti9232
      @studysti9232 7 місяців тому +1

      Hey, make sure your index = searchArray(numbers, size, myNum); line comes AFTER your user input prompt. I had this issue. I hope it solves yours.

  • @Dazza_Doo
    @Dazza_Doo Рік тому

    sizeof(a) //
    typeid(a) // #include