#include<iostream> using namespace std; int sum(int a ,int b){ int c=a+b; return c; } int main(){ int d; int e; cout<<"enter num 1"<<endl; cin>>d; cout<<"enter num 2"<<endl; cin>>e; cout<<"the sum is"<<sum(d+e); return 0; }
PS E:\code practice> cd "e:\code practice\" ; if ($?) { g++ tutt9.cpp -o tutt9 } ; if ($?) { .\tutt9 } tutt9.cpp: In function 'int main()': tutt9.cpp:16:32: error: too few arguments to function 'int sum(int, int)' 16 | cout<<"the sum is"<<sum(d+e); | ^ tutt9.cpp:4:5: note: declared here 4 | int sum(int a ,int b){ | ^~~ PS E:\code practice>
int sum(int a ,int b){
sum(d+e);
sum(d, e)
a
b
d
e
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)