int list1[255]; creates a list with 256 elements, counting element 0 |
wrong!
It does not hurt to rough out the algorithm with a pencil and paper
Maybe the first question should be: "How many lists to be made?"
cin>>a will then get the key board response (say 5)
Now you want the operator to give you the list so:
cout<<"enter the numbers in your first list (separated by spaces)
getline(cin,s)//you need to have previously declared string s.
You now have list #1 in s.
Now in the body of a for loop with finish condition of 1<5 use getline(cin,s[i]) to get s1,s2,s3 and s4. after a suitable prompt. Note:You can obtain the number of integers in each list by calling s.length(). You can print out each string with cout<<s;
Now you have 5 strings each one with a list of integers in it.
So process each string in a new for loop to obtain average from sum /s.length
This may not be the most elegant solution but it is not complicated