write a c++ code to overload + and - for a stack class such
that + provides push and - provides pop operation

Answer Posted / anmol

just leave this question this is the best option i also
done the same thing and got selected

Is This Answer Correct ?    18 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which feature are not hold visual basic of oop?

1721


What is for loop and its syntax?

596


What is polymorphism give a real life example?

557


any one please tell me the purpose of operator overloading

1965


#include #include #include #include void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

2164






What do you mean by variable?

572


Can main method override?

583


What is polymorphism oop?

619


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

942


What is the advantage of oop over procedural language?

625


What is object in oops?

612


What is encapsulation oop?

574


Why multiple inheritance is not possible?

598


#include #include #include #include void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.

3246


What is difference between polymorphism and inheritance?

617