|
Slightly Senior Member
|
well my university (UiTM) uses this officially. My lecturers teach on this as well and the university computers (where we do our practical exams and such) use it as well.. so i'm stuck with it.. anyway its just for Pre-U course.. next semester (january) i dont have C++ anymore so i'll forget about it then
|
|
|
|
|
Less Junior Member
|
Quote:
have u defined your function??? do you know what is a function call, function definition and function prototype??? an example of function definition is void swap(int a[],){ int hold,pass,i; for(pass=1;pass<SIZE;pass++){ for(i=0;i<SIZE-1;i++){ if(a[i]>a[i+1]){ hold=a[i]; a[i]=a[i+1]; a[i+1]=hold; } } } } to call this function use this swap(a); the function prototype is void swap(int ); This code function swap is to swap integer and arrange it from small to big number.It is called bubble sort in C. another note is size is defined using macro and is inside the main program itself.In my knowledge there is no predefined function inside C to swap anything so we have to define it ourself. I write this program in the C language format. It should be similar in C++. ![]() ![]() may this help you
__________________
The 4 rules: 1. Say what you mean. Mean what you say. 2. Don?t say to anyone unless you can say to everyone 3. Don?t say inside, what you cannot say outside. 4. Don?t say unless it is true, useful or kind. Somewhere, somehow |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|