C++ user defined functions (#15) 📬

preview_player
Показать описание
C++ functions tutorial

Coding boot camps hate him! See how he can teach you to code with this one simple trick...

Bro Code is the self-proclaimed #1 tutorial series on coding in various programming languages and other how-to videos in the known universe.
Рекомендации по теме
Комментарии
Автор

// Example 1
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

void welcome(string user_name, int user_age) {
cout << "Welcome to my program! "<<user_name<< endl;
cout << "You are " << user_age <<" yo" << endl;
};

void goodbye() {
cout << "Goodbye!" << endl;
};

int main()
{
//functions
string name;
int age;

cout << "Enter your name: " << endl;
getline(cin, name);
cout << "Enter your age: " << endl;
cin >> age;

welcome(name, age);
goodbye();

cout << endl;
return 0;
}


// Example 2

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

double add(double num1, double num2) {
double result = num1 + num2;
return result;
};

int main()
{
//functions

double number1;
double number2;

cout << "Enter in #1 : " << endl;
cin >> number1;
cout << "Enter in #2 : " << endl;
cin >> number2;

double result = add(number1, number2);

cout << "Your result is: " << result << endl;

cout << endl;
return 0;
}

BroCodez
Автор

i'm paying thousands of dollar to take a class in college so that I can go on youtube and learn it from here. Thanks for the vid bro.

trivo
Автор

starting a video with "Ay its your bro" has a nice, comforting affect. Thank you.

zahraaa
Автор

May the Lord bless your generous soul, Bro Code. May his divine wisdom grant you many blessings. I pray for you in thanks for simplifying this towering obstacle of understanding computer programming. Cheers

GigaWattMan
Автор

I remember when u were at 400 subs! Thxs for helping me on my coding journey!! (:

gamingwithgavin
Автор

Thank you very much c++ Is easy because of you

princesimfukwe
Автор

you make it very easy to understand, thank

loli
Автор

my final is real close
that vid is life saver
thanks bro code

SarkerNayeemImtiaz
Автор

Awesome vid man, you explained it perfectly!

iseespeed
Автор

Do you need to put the semi colon after the ending braces or not I've seen many programs that don't have that

alikarim
Автор

commenting to increase interaction rates for u

respectable
Автор

can you add an Arabic translation please?

Re-hqwx
Автор

As purveyors of code and due to the many videos you create for NEW it would be EXTREMELY Extremely helpful if you....PRIOR to creating any function ....to tell the viewer what the hell a function is and especially a VOID the function is supposed to do like save multiple code by it's very NAME ...VOID what the hell is the sense in having a function that does NOTHING??? Can someone please explain that in simple terms?? And by the way, the only explanation anyone offers is to show this function PRINTING some dumb ass statement??? Is that the only example one can give??? thanks much for letting me rant.

ledschmidt