Consider and ADT list of integers. Write a function that computes the sum of the integers in the list aList. The definition of your function should be independent of the list’s implementation.
may i know how to do this type of question?

Recommended Answers

All 5 Replies

POst your code and we will help you.

i am a novice about programming,pls i need your help to start from the introduction

#include <iostream>

using namespace std;
int main()
{
	cout << "Hello world!" << endl;
	return 0;
}

This is the start of a program now go throw on some ints and add them together. Once that works figure out how to use a container ( list, vector, array... ) and put the numbers in there and then add them up.

#include <iostream>
using namespace std;

int main()
{int numbers[10];
int final;
int i;
while(i>10)
{
final += numbers[i]
}
cout << final;
}

you could do this in a function or any other place. it would still work.
numbers[10];
is your "aList."

We make it a point to avoid writing code for you. If you already have code then we would be more than happy to help you with it.
It is better if you can figure out what to write (weather or not it works) and then we can and help you work off of it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.