CSC160 (UG20) 01
TPS 6: Arrays/vectors
Skip To Content
Dashboard
  • Login
  • Dashboard
  • Calendar
  • Inbox
  • Help
Close
  • My Dashboard
  • CSC160 (UG20) 01
  • Assignments
  • TPS 6: Arrays/vectors
SP 2021 (UNDG)
  • Home
  • Assignments
  • Modules
  • TC/WC Appt Scheduler
  • Collaborations
  • WSJ Context
  • EvaluationKIT Course
  • EvaluationKIT
  • Barnes & Noble Bookstore
  • Badges
  • Stukent

TPS 6: Arrays/vectors

  • Due Mar 10, 2021 by 10am
  • Points 1
  • Submitting a file upload
  • File Types doc and docx
  • Available after Mar 10, 2021 at 9am

Consider the following program that reads in three floating point numbers in from the user into an array:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

int main(){
    const int CAPACITY = 3;
    double nums[CAPACITY];

    // Read in the values.
    cout << "Please enter " << CAPACITY << " numbers: ";
    for(int i = 0; i < CAPACITY; i++){
        cin >> nums[i];
    }

    // Display them as a list in the form: (x, y, z,)
    cout << "(";
    for(int i = 0; i < CAPACITY; i++){
        cout << nums[i] << ",";
    }
    cout << ")" << endl;

    return 0;
}

What needs to change if we want to modify this to use vectors? Provide the code or explain in English.

 

After we've completed the group share portion, upload a copy of your updated TPS document.

1615388400 03/10/2021 10:00am
Additional Comments:
Rating max score to > pts

Rubric

 
 
 
 
 
 
 
     
Can't change a rubric once you've started using it.  
Find a Rubric
Find Rubric
Title
You've already rated students with this rubric. Any major changes could affect their assessment results.
Title
Criteria Ratings Pts
Edit criterion description Delete criterion row
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit rating Delete rating
5 to >0 pts
Full Marks
blank
Edit rating Delete rating
0 to >0 pts
No Marks
blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
Total Points: 5 out of 5