0

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?

6
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by kernel>panic
-2

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

0
#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.

0
#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."

Edited by jackmaverick1: CODE TAGS!

0

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.

Edited by kernel>panic: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.