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
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

CO1512 November 2016 exam Memo

Document preview thumbnail
Preview 2 out of 8 pages

This is the memorandum for the November exams written in 2016

Content preview

COS1512_Nov2016_MEMO Tutorials Campus www.tutorialscampus.co.za


Question 1

1.1 strcpy(saveWord, word); // C-strings use the function strcpy to copy one string to another

1.2 if(strcmp(word, saveWord)) // C-strings use the function strcmp to compare two strings

1.3 int j = 4;

Question 2

2.1




2.2

void count(int counter)



2.3

count(--counter);



2.4

assert(counter>=0);



Question 3

3.1

a = (*p1 *2) /5;



3.2

Creating a new int nameless variable an assigning the pointer p1 to point to it

3.3

We cannot assign the address of pointer p1 to another pointer p2, because it has been deleted


pg. 1  for more information contact Nicholas on 083 33 13 124

, COS1512_Nov2016_MEMO Tutorials Campus www.tutorialscampus.co.za


3.4

p3 = &a;



3.5

To access actual value that pointer p3 is pointing to.



Question 4

4.1

#ifndef BURSARY_H

#define BURSARY_H



#include <iostream>

using namespace std;



class Bursary

{
public:

Bursary();

Bursary(int studentNumberP, int yearsOfStudentP, int modulesPassedP);

~Bursary();

int get_Number();

void yearOfStudy(int yearsOfStudent);

friend bool operator==(const Bursary & bursary1, const Bursary & bursary2);

friend istream& operator>>(istream& ins, Bursary& b);



private:

int studentNumber;

int yearsOfStudent;

int modulesPassed;



};

pg. 2  for more information contact Nicholas on 083 33 13 124

Connected book
 image
Walter J. Savitch Problem Solving with C++
Publisher: 2007 ISBN: 9788170085645 Edition: Unknown

Document information

Uploaded on
November 9, 2022
Number of pages
8
Written in
2015/2016
Type
Exam (elaborations)
Contains
Questions & answers
$6.39

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

Sold
5
Followers
4
Items
14
Last sold
3 year ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions