CSC-138

Apr 3, 2014 at 3:20am
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 Apr 24, 2014 at 12:29am
Apr 3, 2014 at 3:36am
What exactly do you need help with other than the answer?
Apr 4, 2014 at 8:26pm
I want now the different when we use them in program?
Apr 4, 2014 at 8:52pm
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 Apr 4, 2014 at 8:52pm
Apr 9, 2014 at 8:53pm
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!
Apr 9, 2014 at 9:04pm
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?
Apr 13, 2014 at 5:52am
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?
Apr 13, 2014 at 6:12am
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 Apr 13, 2014 at 6:12am
Apr 24, 2014 at 1:10am
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!
Apr 25, 2014 at 8:29pm
Hi, I have some questions if any one you can answer for me.
1. what is pointer?
2. what is the use?
Apr 25, 2014 at 8:35pm
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.