Layout of user-define function

#include <iostream>
using namespace std;
int sum (); // essential part
void main()
{

  int result=sum(); // name a variable as the name of function (automatically the retuen value is save in it)
  cout<<"The result of additional is "<<result<<endl; // use the variable
}

int sum () // function name
{
int a=10;
int b=10;
int ans=a+b;

return ans; // the value in answer can b use any where, where the function is call
}

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System