Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Solutions for the study guide

Beoordeling
-
Verkocht
1
Pagina's
65
Cijfer
A+
Geüpload op
02-05-2023
Geschreven in
2022/2023

Solutions for the study guide

Instelling
Vak

Voorbeeld van de inhoud

COS1511/102/3/2014




Tutorial letter 102/3/2014

Introduction to Programming 1
COS1511

Semesters 1 & 2


School of Computing


IMPORTANT INFORMATION:
This tutorial letter contains the answers to the
exercises in the study guide.

, TUTORIAL MATTER


Up to now you should have received the material listed below. If not, please download it from myUnisa
immediately (see below) and also contact the Department of Despatch by sending a sms including your query and
student number to 43579, or email .

Study Guide

DISK 2014 (with software )

Tutorial letters
COSALLF/301/4/2014
General information concerning the School and study at Unisa

COS1511/101/3/2014

Information about COS1511

Assignments

COS1511/102/3/2014 (this letter)

Please note the following

 For e-mail, use the module address namely if you are registered for the first
semester and if you are registered for the second semester.

 Web addresses for downloading of tutorial matter
my.unisa.ac.za

 You need AT LEAST 8 hours study time per week for this module.

Other contact numbers (include your student number in your enquiry)

 For enquiries about registration, send a sms to 43578
 To contact the assignment or examination section, send a sms to 43584
 If you do not receive your study material, send a sms to 43579
 For problems with myUnisa, send a sms to 43582
 For academic queries in the School of Computing, email the lecturer – see myUnisa.
 For any non-academic query you may also send and email to



Afrikaanssprekende studente: Studiemateriaal vir COS1511 is slegs in Engels beskikbaar. As enigiets
onduidelik is, is u baie welkom om ons te kontak.




Your programs need not be identical to ours. It is, however, important that your programs yield the correct results
(thus extensive testing is essential) and that you use good programming style as explained in the Study Guide. You
should, for example,
 use meaningful names for variables, constants, functions, etc,
 indent your code correctly,
 include comments,
 declare constants where appropriate,
 avoid the use of global variables,
 use the correct types of functions as well as
 the correct types of parameters.



2

, COS1511/102

LESSON 1

Exercise 1.1

We repeat the program here:
#include <iostream>
using namespace std;
int main( )
{ cout << "Hello world"; return 0; }

Descriptive Comment:

There is no descriptive comment.
StandardHeaderFile:

iostream

StatementSequence:

cout << "Hello world"; return 0;

Exercise 1.2

//A poem
#include <iostream>
using namespace std;
int main( )
{
cout << "Twinkle, twinkle, little bat!" << endl;
cout << "How I wonder what you're at?" << endl;
cout << "Up above the world you fly," << endl;
cout << "Like a tea-tray in the sky." << endl;

return 0;
}

LESSON 2

Exercise 2.1

(i) (() + ())

| |

16 + 11

|

27



(ii) ((-5 + -4) - -3)

|

-9 - -3

|
-6




3

, (iii) (((6 * 7) / 8) * 9)

|

42 / 8 * 9

|

5 * 9
|

45



(iv) ((1 - 2) + (() * 5))

| |

-1 + 0 * 5

|

-1 + 0

|

-1



(v) ((-1 + (23 / -4)) + 56)
|

-1 + -5 + 56

|
-6 + 56

|

50

Exercise 2.2

//Lesson 2 Exercise 2.2
//display number of seconds in a minute, hour, day and year
#include <iostream>
using namespace std;
int main()
{
cout << "The are 60 seconds in a minute." << endl;
cout << "The are " << 60 * 60 << " seconds in an hour." << endl;
cout << "The are " << 60 * 60 * 24 << " seconds in a day." << endl;
cout << "The are " << 60 * 60 * 24 * 365 << " seconds in a year." << endl;
return 0;
}

Exercise 2.3

//Lesson 2 Exercise 2.3
#include <iostream>
using namespace std;

int main( )
{
cout << "The remainder of 234 divided by 13 is ";

4

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
2 mei 2023
Aantal pagina's
65
Geschreven in
2022/2023
Type
Tentamen (uitwerkingen)
Bevat
Alleen vragen

Onderwerpen

Gratis
Krijg toegang tot het volledige document:
Downloaden

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kan je een ander document kiezen. Je kan het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
thapelolebea

Maak kennis met de verkoper

Seller avatar
thapelolebea Free lance
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1
Lid sinds
2 jaar
Aantal volgers
1
Documenten
1
Laatst verkocht
2 jaar geleden
Free lance

Free lancing for C++ related projects

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Populaire documenten

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 Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

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

Alisha Student

Veelgestelde vragen