Hey ya'll here's another example that might demonstrate the use of 'return' better. #include // Function to check if age is 18 or over bool isAdult(int age) { if (age >= 18) { return true; } else { return false; } } int main() { int age = 0; std::cout > age; if (isAdult(age)) { std::cout
I think he did not. For your understanding, "void" is a keyword which is used with a function when the function is not supposed to return anything. In the example, he is not returning anything from the function after the operations are completed, hence he used "void". :)
Hey ya'll here's another example that might demonstrate the use of 'return' better.
#include
// Function to check if age is 18 or over
bool isAdult(int age) {
if (age >= 18) {
return true;
}
else {
return false;
}
}
int main() {
int age = 0;
std::cout > age;
if (isAdult(age)) {
std::cout
Are you preparing more videos on C++ in the future?
I really like your C++ series. Keep it up. Please make more C++ Videos. So, let's defeat the RUclips algorithm.
#include
#include
double sum(float x, float y);
int main(){
float x = 5.6;
double b = 2.3;
float result = sum(a, b);
std::cout
#include
#include
double calcultor(double sidea, double sideb);
int main(){
double x;
double y;
std::cout > x;
std::cout > y;
double lol = calcultor(x,y);
std::cout
#include
double sum(double a, double b);
int main(){
double a = 5;
double b = 4;
double result = sum(a, b);
std::cout
Doesn't it loop on itself or ir overall less ificient?
Ok nevermind I get it now
did you explain somewhere void keyword and i missed it?
I think he did not. For your understanding, "void" is a keyword which is used with a function when the function is not supposed to return anything. In the example, he is not returning anything from the function after the operations are completed, hence he used "void". :)
@@RandomCommentator15 thanks for the reply ill review the video and try to absorb it
#include
void fullname(std::string firstname , std::string lastname);
int main(){
std::string firstname = "bro";
std::string lastname = "great";
fullname(firstname , lastname);
return 0;
}
void fullname(std::string firstname , std::string lastname){
std::cout
is this important to learn?
obviously it is necesary to learn each and every concept
#include
#include
double pythagStuff( double adjac, double oppie) ;
int main()
{
double adjac;
double oppie;
std::cout