CSC-138

Please I need help this questions

1. What is the difference between a (binary) operator and a function?
2. Is it possible using operator overloading to change the behavior of + on integers? Why or why not?
I want now the different when we use them in program?
Last edited on
What exactly do you need help with other than the answer?
I want now the different when we use them in program?
1. No difference. An operator is type of function. It just uses a different syntax than conventional "functions"
2. No, because you can't overload any type of function with two identical sets of declarations (accepting two int types).
Last edited on
Hi all pleas i need help with this Home work I don't now how to wright the code for this quotation?

Write a template version of Bubble sort algorithm. The function should look like:
template <class T>
void BubbleSort(T A[], int N)
where A -- array to sort, N -- number of elements in the array;
thank you any one can help me!
your book, or google, will have the outline for the code to a bubble sort. you just pass an array, the type of which is instantiated by you to whatever you want (int, string, etc). is there something specific you don't understand, like templates?
Hey, this is the code I made, but it not working I don't now why pleas help me this is what I'm try to do,
Write a template version of Bubble sort algorithm. The function should look like:
template <class T>
void BubbleSort(T A[], int N)
where A -- array to sort, N -- number of elements in the array;



#include <iostream>
using namespace std;
template <class T>
void bubblesort (T A[], int K)
{
for (int i = 0; i < K; i++)
for (int j = i + 1; j < size; j++)
if (A[j] < A[i])
{
T aux;
aux = A[i];
A[i] = A[j];
A[j] = aux;
}
}
it is any body can help me?
For starters you are missing the main function. You are also missing a semi colon at the end of the prototype and the line after should be commented out with // . Also please use code tags around your code [᠋code]your code here[᠋/code] --ps I used a special symbol so that's why it doesn't look like: your code here
Last edited on
Hi, I have some questions if any one you can answer for me.
1. what is pointer?
2. what is the use?
3. why are we use in it?
4. pleas can u give me an examples?
thank you for your time!
Hi, I have some questions if any one you can answer for me.
1. what is pointer?
2. what is the use?
Pointers are objects that point to a block of memory. They can be useful if you need a dynamic array and you for some really weird reason don't want to use a dynamic container like std::vector<T>. There are other uses too like polymorphism. Most people tend to use smart pointers though like std::unique_ptr<T>

http://www.cplusplus.com/doc/tutorial/pointers/
http://www.learncpp.com/ <--chapter 6
Topic archived. No new replies allowed.