Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Solutions for the study guide

Rating
-
Sold
1
Pages
65
Grade
A+
Uploaded on
02-05-2023
Written in
2022/2023

Solutions for the study guide

Institution
Course

Content preview

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

Written for

Institution
Course

Document information

Uploaded on
May 2, 2023
Number of pages
65
Written in
2022/2023
Type
Exam (elaborations)
Contains
Only questions

Subjects

Free
Get access to the full document:
Download

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
thapelolebea

Get to know the seller

Seller avatar
thapelolebea Free lance
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
2 year
Number of followers
1
Documents
1
Last sold
2 year ago
Free lance

Free lancing for C++ related projects

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions