//mutifunction
#include <iostream>
usingnamespace std;
void add(int, int);
int addition(int,int);
int main()
{
int a = 3, b = 5;
add(3,5);
return 0;
int meow = addition(a,b);
cout << meow << endl;
}
void add(int c, int d)
{
int even = c + d;
cout << even << endl;
}
int addition(int e, int f)
{
int cheese = e + f;
return cheese;
}
Everything after the return is ignored, you exit the main function. try putting it after the cout in main. The void function will never return anything thats why it is void, meaning nothing or no return.
//mutifunction
#include <iostream>
usingnamespace std;
void cheese(int a, int b)
{
int meow;
meow = a + b;
cout << meow << endl;
}
int chee(int a, int b)
{
int m;
m = a + b;
return m;
}
int main()
{
int r = 3, t = 5;
cheese(r,t);
int meoww = chee(r,t);
cout << meoww << endl;
}
killertcell you said in your last post you rewrote without the function you can keep the function. What was said is return 0; in the main() function needs to be on the last line. Do that and it all works.
//mutifunction
#include <iostream>
usingnamespace std;
void add(int, int);
int addition(int,int);
int main()
{
int a = 3, b = 5;
add(3,5);
int meow = addition(a,b);
cout << meow << endl;
return 0;
}
void add(int c, int d)
{
int even = c + d;
cout << even << endl;
}
int addition(int e, int f)
{
int cheese = e + f;
return cheese;
}
when main hits return0; its saying "Ok im done. programs fully done".
it returns that 0 to what ever called it to prove it was done basically.