90 205
Assignments Done
99.5%
Successfully Done
In September 2020

# Answer to Question #37765 in C++ for Dil

Question #37765
Write a function that, using default arguments, allows user to take the sum of anywhere between 2 and 4 integers. This is what i got so far....#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

using namespace std;

void sum(float a,float b);
void sum(int a,int b, int c = 0);
double sum(double a, double b, double c, double d);

int main(int argc, char *argv[])
{
int no[4];

cout&lt;&lt; &quot;Enter any number from 2 to 4: &quot;&lt;&lt;endl;

//Loop until EOF
for(int i=0; no[i]-1 != EOF; i++){
cout&lt;&lt; &quot;&gt;&gt; &quot;;
cin&gt;&gt; no[i]; //Ask value array no[]
i++;
}

sum(no[0],no[1],no[2],no[3]); //call function

system(&quot;PAUSE&quot;);
return EXIT_SUCCESS;
}
//FUNCTION
int sum(int a, int b){
return a + b;
}

float sum(float a, float b, float c){
return a + b + c;
}
double sum(double a, double b, double c, double d){
return a + b + c + d;
}
1
2013-12-13T09:33:42-0500

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Assignment Expert
16.12.13, 10:35

If you really liked our service please press like-button beside answer field. Thank you!

Dils
14.12.13, 07:10