#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
@@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
@@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.
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
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
#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
The house thing you said really helped me understand formatting so much better. You have taught me more than this stupid college class.
you explained it so goood ı've never understand the functions this well thank you
I really like your C++ series. Keep it up. Please make more C++ Videos. So, let's defeat the RUclips algorithm.
tip from papa please use using namespace std;
Its a bad practice in professional environment
@@HabiburRahman-mm2su why ?
@@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
@@mhmdhusseini4864 i heard that way you force every dependent file to use the same namespace
@@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.
God bless you
incredible speed of code execution
thank you amazing video
Thank you sm🙏🏼
Simple weight calculator. - Pretty efficient.
#include
void weightCalc() {
int mass ;
double weight ;
std::cout mass;
std::cout
Thank you
DONE😌😌❤❤
احبك✋️
🔥🔥❤❤DONE🔥🔥❤❤
what is void?
no return type (does not give anything back)
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
@@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;?
@AdrielBryanCherian In order to stop it you have to return int, it doesnt have to be 0, but yes it can be
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
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
good tiigao chan
@@rivazmardani *chan =}}}
}
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
Gui in c--
#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
#include
void song(int age = 19, std::string Name = "Christian") {
std::cout