Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

Solutions for the study guide

Puntuación
-
Vendido
1
Páginas
65
Grado
A+
Subido en
02-05-2023
Escrito en
2022/2023

Solutions for the study guide

Institución
Grado

Vista previa del contenido

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

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
2 de mayo de 2023
Número de páginas
65
Escrito en
2022/2023
Tipo
Examen
Contiene
Solo preguntas

Temas

Gratis
Accede al documento completo:
Descarga

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor
Seller avatar
thapelolebea

Conoce al vendedor

Seller avatar
thapelolebea Free lance
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1
Miembro desde
2 año
Número de seguidores
1
Documentos
1
Última venta
2 año hace
Free lance

Free lancing for C++ related projects

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Documentos populares

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes