Computers and Technology
Computers and Technology, 12.03.2021 15:30, F3R

In this lab, we review and practice arrays and functions. You will practice: How to use array to store a collection of values:
partially filled array (using a int variable to keep track of the number of elements)
searching for a value in the array,
inserting an element into the array,
deleting an element from the array,
reversing the array and using swap.
How to clearly declare a function by writing concise function comments, and specifying properly name, parameters and return type for the function. This step address the question of what the function is supposed to do?
Passing array as parameter to function: both the array and the number of elements need to be passed to the function
Call-by-value and call-by-reference
return type: for functions that perform some kind of checking, it should return bool type.
How to implement a function given its declaration. This step takes care of How the function works? When implementing a function, all you need to know is the function's declaration.
Example Output:
Enter a list of up to 20 integers or -1 to end the list
3 2 4 8 12 5 6 9 0 11 10 13 -1
3 2 4 8 12 5 6 9 0 11 10 13
Enter a value and a position to insert: 18 5
3 2 4 8 12 18 5 6 9 0 11 10 13
Enter a value to delete from the array: 18
3 2 4 8 12 5 6 9 0 11 10 13
Enter a value to append: 15
3 2 4 8 12 5 6 9 0 11 10 13 15
15 13 10 11 0 9 6 5 12 8 4 2 3
Please fill in the code in all places where there have a ToDo comment.
Hints
Start with the simiplest function, e. g., the one to search the content of an array.
The suggested order to write the function is:
Function to search for a value in the array
Function to fill an array with positive integers
Function to delete an element from the array: after deletion, the array should have no holes.
Function to insert an element into the array
Write one function, test it to make sure it really works, and then move on to next function.
Write comments to 1) document your algorithms and design, 2) make your code readable, 3) debug code.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, josephmelichar777
Write a full class definition for a class named player , and containing the following members: a data member name of type string .a data member score of type int .a member function called setname that accepts a parameter and assigns it to name . the function returns no value. a member function called setscore that accepts a parameter and assigns it to score . the function returns no value. a member function called getname that accepts no parameters and returns the value of name .a member function called getscore that accepts no parameters and returns the value of score .this is what i have, aparently this is wrong: class player{private: string name; int score; public: void player: : setname (string n){name =n; }void player: : setscore (int s){score = s; }string player: : getname (){return name; }int player: : getscore (){return score; }};
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, Molly05
In my email i got a message it says a quick message and in message details on who its from its says nicole and under nicole is 50e0bf08e5b671@ualwgypg91wa5wl. uzo9kbud3qjwddygd5.vng -
Answers: 1
image
Computers and Technology, 23.06.2019 13:00, torresnoemi899
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
image
Computers and Technology, 24.06.2019 08:10, anthonysutton82
Where are american poets found in the dewey decimal system
Answers: 1
Do you know the correct answer?
In this lab, we review and practice arrays and functions. You will practice: How to use array to st...

Questions in other subjects:

Konu
Geography, 20.11.2020 22:10
Konu
Mathematics, 20.11.2020 22:10
Konu
Health, 20.11.2020 22:10
Konu
Health, 20.11.2020 22:10