[SOLVED] CptS 122 Lab #1

20.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (8 votes)

This lab is comprised of two tasks. Both tasks must be completed in order to receive credit for this lab.
Task #1
Please complete the online survey at http://survey.osble.org/index.php?sid=97282. Note that this survey may look very familiar to many 121 students 🙂
Task #2
This task picks up from last week’s lectures on developing dynamically expanding arrays (i.e. vectors). In lecture, we developed a vector of integers. In this lab, you must develop similar vectors for the other C data types: doubles and chars. In total, you must add to Vectors.h/c (provided with this file) the following structs and functions:
ï‚· A “DoubleVector_t” struct
ï‚· A “CharVector_t” struct
ï‚· DoubleVector_t doubleVector_init(int initial_size)
o Initializes a new DoubleVector_t for the programmer to use
ï‚· void doubleVector_resize(DoubleVector_t *some_vector, int new_size)
o Resizes a DoubleVector_t to the specified size
ï‚· void doubleVector_insert(DoubleVector_t *some_vector, int location, double value)
o Replaces the item presently at “location” with “value”
ï‚· void doubleVector_add(DoubleVector_t *some_vector, int location, double value)
o Shifts all values starting at “location” to the end of the vector right by one, then inserts “value” at “location”
ï‚· CharVector_t charVector_init(int initial_size)
o Initializes a new CharVector_t for the programmer to use
ï‚· void charVector_resize(CharVector _t *some_vector, int new_size)
o Resizes a CharVector _t to the specified size
ï‚· void charVector_insert(CharVector _t *some_vector, int location, char value)
o Replaces the item presently at “location” with “value”
ï‚· void charVector_add(CharVector _t *some_vector, int location, char value)
o Shifts all values starting at “location” to the end of the vector right by one, then inserts “value” at “location”
To receive credit for this task, you must implement a simple “driver” program that uses and tests each function.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.