//*****************************************************************************
// CPSC1620 - Fall 2008                                                         
//                                                    
//                                                                              
// Date:                                                                        
// Purpose: Program to perform array operations using functions                 
//*****************************************************************************


#include <iostream>
using namespace std;

//Prototype                                                                     
int readSeq(int []);



int main()

{



   return 0;


}

//*****************************************************************************
//Function: readSeq                                                             
//Assumption: Reads a sequence of integers                                      
//Action: Stores the sequence in the array given as parameter                   
//*****************************************************************************

int readSeq(int [])


{






}

I'm not good with arrays I don't understand them. I have to make a function that reads squence of integers from the input and stores the sequence of numbers in the array give as a parameter. What would my first step be?

Recommended Answers

All 4 Replies

http://www.cplusplus.com/doc/tutorial/arrays.html

read that it might help. I am kind of confused on what you need to do. What is readSeq supposed to return? for example what is the int that it returns supposed to represent? The most recently read number?

http://www.cplusplus.com/doc/tutorial/arrays.html

read that it might help. I am kind of confused on what you need to do. What is readSeq supposed to return? for example what is the int that it returns supposed to represent? The most recently read number?

I understand a bit, but how do i store the sequence in the array given as a parameter?

well first of all the paramater was written wrong. It needs to be something like

int readSeq(int NAMEOFARRAY[])

The array has to have a name. I still dont understand what the function is trying to return. All I know is that it is of type int. If you could tell me what it is returning mabye I oculd figure out what the structure of the program should be. I just cant see it right now.

Well, since the description of the readSeq funcion doesn't actually describe what it is returning, maybe it should be void readSeq, rather than int. And as of passing parameters, why do you need to pass the array..? Do you really need a separate function? And how are you getting these sequences of numbers? Do you know how many numbers are being given? If you don't, you probably want to make it dynamic array (which then you will have to pass the array as pointer). You need to clarify more.

but here's what i'd do

loop
print "enter a number"
arrayName = number

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.