i want to fix the errpr and make the program run
#include%26lt;iostream%26gt;
using namespace std;
double sum( double * begin, double * end) {
double *p = begin;
double result = 0;
while (p != end) {
result += *p++;
}
return result;
}
int main()
{
double *first,*last;
cout%26lt;%26lt;"enter the begin of the array \n";
cin%26gt;%26gt;* first;
cout%26lt;%26lt;"enter the last item in the array \n";
cin%26gt;%26gt;* last;
cout%26lt;%26lt;sum(* first,* last);
system("pause");
return 0;
}
C++ help???
#include%26lt;iostream%26gt;
using namespace std;
double sum( double * begin, double * end) {
double *p = begin;
double result = 0;
while (result %26lt; *end) { // %26lt; end
result += *p+result;
}
return result;
}
int main()
{
double first,last;
cout%26lt;%26lt;"enter the begin of the array \n";
cin%26gt;%26gt;first;
cout%26lt;%26lt;"enter the last item in the array \n";
cin%26gt;%26gt;last;
cout%26lt;%26lt;sum(%26amp;first,%26amp;last);
system("pause");
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment