100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS1512 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 4 August 2025; 100% TRUSTED Complete, trusted solutions and explanations Ensure your success with us..

Beoordeling
-
Verkocht
-
Pagina's
10
Cijfer
A+
Geüpload op
04-08-2025
Geschreven in
2025/2026

COS1512 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 4 August 2025; 100% TRUSTED Complete, trusted solutions and explanations Ensure your success with us..

Instelling
Vak









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
4 augustus 2025
Aantal pagina's
10
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

COS1512 Assignment
3 (COMPLETE
ANSWERS) 2025 - DUE
4 August 2025
NO PLAGIARISM
[Pick the date]
[Type the company name]


, Exam (elaborations)
COS1512 Assignment 3 (COMPLETE
ANSWERS) 2025 - DUE 4 August 2025
 Course
 Introduction to Programming II (COS1512)
 Institution
 University Of South Africa (Unisa)
 Book
 Introduction to Programming

COS1512 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 4 August 2025;
100% TRUSTED Complete, trusted solutions and explanations Ensure your
success with us..



Question 1 Write a program that asks a user to enter the size of a dynamic
array that stores exam marks obtained by students. Create the dynamic
array and a loop that allows the user to enter an exam mark into each array
element. Loop through the array, find the average mark for the exam and
output it. Delete the memory allocated to your dynamic array before exiting
your program.
#include <iostream>
#include <new> // Required for std::bad_alloc
#include <iomanip> // Required for formatting the output

int main() {
// --- Step 1: Ask the user for the size of the dynamic array ---
int arraySize;
std::cout << "Enter the number of students (size of the array): ";
std::cin >> arraySize;

// Validate that the size is a positive number
if (arraySize <= 0) {
std::cerr << "Error: The array size must be a positive number."
<< std::endl;
return 1; // Exit with an error code
}

// --- Step 2: Create the dynamic array and handle memory allocation
errors ---
// We use a try-catch block to handle the case where memory cannot be
allocated.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ivymwendwa47820 University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
357
Lid sinds
1 jaar
Aantal volgers
156
Documenten
883
Laatst verkocht
1 maand geleden

3,6

71 beoordelingen

5
29
4
13
3
13
2
5
1
11

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen