C++ user defined functions explained 📞

Поделиться
HTML-код
  • Опубликовано: 11 фев 2025
  • C++ functions tutorial example explained
    #functions #programming

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

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

    #include
    void happyBirthday(std::string name, int age);
    int main()
    {
    // function = a block of reusable code
    std::string name = "Bro";
    int age = 21;
    happyBirthday(name, age);
    return 0;
    }
    void happyBirthday(std::string name, int age){
    std::cout

  • @GentleBongRips
    @GentleBongRips 5 дней назад +1

    The house thing you said really helped me understand formatting so much better. You have taught me more than this stupid college class.

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

    you explained it so goood ı've never understand the functions this well thank you

  • @FrederikWollert
    @FrederikWollert 10 месяцев назад +12

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

  • @KapeelManek
    @KapeelManek 2 месяца назад +22

    tip from papa please use using namespace std;

    • @HabiburRahman-mm2su
      @HabiburRahman-mm2su Месяц назад +4

      Its a bad practice in professional environment

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

      @@HabiburRahman-mm2su why ?

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

      @@mhmdhusseini4864
      I'm not a professional, but I will try to explain it as well as I can.
      Writing "using namespace std" is considered a bad practice, because it makes it more likely for a name clash to happen.
      If you are writing a small program, something like "Hello world" then using "using namespace std" is fine, but the problem arises with bigger projects.
      Let's say we got a statement "std::cout

    • @dvxv4016
      @dvxv4016 27 дней назад

      @@mhmdhusseini4864 i heard that way you force every dependent file to use the same namespace

    • @HabiburRahman-mm2su
      @HabiburRahman-mm2su 17 дней назад +2

      @@mhmdhusseini4864 It’s because there can be other custom namespaces as well. While in case of learning,
      " using namespace std:" is okey, but "std::" makes working easier for others coders, as well as not forcing them to scroll from bottom to top for modification.

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

    God bless you

  • @Mostafa_Kabici
    @Mostafa_Kabici 4 месяца назад +1

    incredible speed of code execution

  • @blazing-h1l
    @blazing-h1l 3 месяца назад +1

    thank you amazing video

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

    Thank you sm🙏🏼

  • @johnny_ow
    @johnny_ow 9 месяцев назад +7

    Simple weight calculator. - Pretty efficient.
    #include
    void weightCalc() {
    int mass ;
    double weight ;
    std::cout mass;
    std::cout

  • @محمدالعريقي-خ4ج
    @محمدالعريقي-خ4ج 2 месяца назад

    Thank you

  • @MainulHossainAnik
    @MainulHossainAnik 22 дня назад +1

    DONE😌😌❤❤

  • @joud4508
    @joud4508 3 месяца назад +1

    احبك✋️

  • @MainulHossainAnik
    @MainulHossainAnik 20 дней назад +1

    🔥🔥❤❤DONE🔥🔥❤❤

  • @memezilla2964
    @memezilla2964 8 месяцев назад +3

    what is void?

    • @Ctrl-Z-Renders
      @Ctrl-Z-Renders 5 месяцев назад +7

      no return type (does not give anything back)

    • @Anonymous-st1vk
      @Anonymous-st1vk 5 месяцев назад +4

      if you write int in place of void, it means the function return integer when executed (like the main function), void means it a funtion that doesn't return anything, other datatypes can also be put here

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

      @@Anonymous-st1vk which means that in order to stop a function that has a int in place of void.. you would have to return 0;?

    • @fakemand
      @fakemand 19 дней назад +1

      @AdrielBryanCherian In order to stop it you have to return int, it doesnt have to be 0, but yes it can be

    • @Yourcodingfriend9999
      @Yourcodingfriend9999 4 дня назад +1

      Ok soo to create a function in c and c++
      we can use void but it will return nothing and you can use data types like int, double they will return something but only the function's data type

  • @taigo5766
    @taigo5766 2 года назад +14

    finally, hello world v2.0
    #include
    void hello(std::string world);
    int main()
    {
    std::string world = "Hello, World!";
    hello(world);
    return 0;
    }
    void hello(std::string world)
    {
    std::cout

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

      good tiigao chan

    • @Yureki
      @Yureki 2 года назад

      @@rivazmardani *chan =}}}

  • @sviatoidyx4672
    @sviatoidyx4672 9 месяцев назад +3

    }
    void find_x(double a, double b, double c ){
    double x1;
    double x2;
    double D = pow(b,2) - 4*a*c;
    if (D>0){
    x1=(-b+sqrt(D))/2*a;
    x2=(-b-sqrt(D))/2*a;
    std::cout

  • @Hasnain-mahdi
    @Hasnain-mahdi Месяц назад

    Gui in c--

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

    #include
    using namespace std;
    void happyBoy(bool IsHappy, string name);
    int main() {
    bool IsHappy = true;
    string name = "Andrew";
    happyBoy(IsHappy, name);
    return 0;
    }
    void happyBoy(bool IsHappy, string name);
    cout

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

    #include
    void song(int age = 19, std::string Name = "Christian") {
    std::cout