Announcements | Last Post | |
---|---|---|
![]() |
SoC Curricula | 09/30/2017 01:08PM |
![]() |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM |
![]() |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM |
![]() |
Unisa contact information | 07/28/2011 01:28PM |
Assignment 2 Queries March 26, 2009 11:26AM |
Registered: 10 years ago Posts: 15 Rating: 0 |
March 26, 2009 11:37AM |
Registered: 14 years ago Posts: 560 Rating: 2 |
Re: Assignment 2 Queries March 26, 2009 11:39AM |
Registered: 10 years ago Posts: 15 Rating: 0 |
March 26, 2009 11:52AM |
Registered: 14 years ago Posts: 560 Rating: 2 |
Language: C++int x = nrToBepacked / nrInEveryContainer; // int division discards the remainder //test to see if there is a remainder //can';t have 1/2 of a container !! if ( nrToBepacked % nrInEveryContainer) > 0 x++; return x
Re: Assignment 2 Queries March 26, 2009 11:55AM |
Registered: 10 years ago Posts: 15 Rating: 0 |
March 26, 2009 11:59AM |
Registered: 14 years ago Posts: 560 Rating: 2 |
Re: Assignment 2 Queries March 26, 2009 05:00PM |
Registered: 10 years ago Posts: 15 Rating: 0 |
March 26, 2009 05:21PM |
Registered: 14 years ago Posts: 560 Rating: 2 |
Language: C++//Simple function call with parameters #include <iostream> using namespace std; //function prototype int func(int x, int y); //main program int main() { int n1, n2; cout << "Enter 2 integers" << endl; cin >> n1 >> n2; //calling function with parameters (n1 and n2) // NB! The position of the parameters when the call is made !! cout << n1 << " + " << n2 << " = " << func (n1,n2) << endl; return 0; } //function implementation int func(int x, int y) { return ( x + y); } /* OR like this int func(int x, int y) { int z; return (z = x + y); } */
Re: Assignment 2 Queries April 06, 2009 09:42AM |
Registered: 10 years ago Posts: 15 Rating: 0 |
April 06, 2009 10:22AM |
Registered: 14 years ago Posts: 560 Rating: 2 |
Language: C++int x = 5;
Language: C++int x = 5; if (x==6) then cout << " True" << endl; else cout << "False" << endl;
Re: Assignment 2 Queries April 06, 2009 10:28AM |
Registered: 10 years ago Posts: 15 Rating: 0 |
May 06, 2009 11:40PM |
Registered: 10 years ago Posts: 2 Rating: 0 |