| | |
plz help me
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 10
Reputation:
Solved Threads: 0
hi.
i have to do addition,multiplication,division and substraction of large numbers using c++.
Using pointers and struct .I m sending some code.plz if anyone can do this program help me.
here r some code
plz send me on fri_003@yahoo.co.in
as soon as possible.
i have to do addition,multiplication,division and substraction of large numbers using c++.
Using pointers and struct .I m sending some code.plz if anyone can do this program help me.
here r some code
plz send me on fri_003@yahoo.co.in
as soon as possible.
C++ Syntax (Toggle Plain Text)
#include<stdio.h> struct node { long int data; struct node* llink; struct node* rlink; node() { data=0; llink = NULL; rlink = NULL; } }; struct head { int noofdigit; char sign; struct node* left; struct node* right; head() { noofdigit = 0; sign =0; left = NULL; right =NULL; } }; char Sign(struct head* headpointer) { return headpointer->sign; } struct node* FirstLeft(struct head* headpointer) { return headpointer ->left; } struct node* FirstRight(struct head* headpointer) { return headpointer ->right; } struct node* NextLeft(struct node* nodetosearch) { return nodetosearch ->rlink; } void InsertLeft(struct head* headnode,struct node* nodetoinsert) { if(FirstLeft(headnode) ==NULL || FirstRight(headnode) == NULL) { headnode ->left = nodetoinsert; headnode ->right = nodetoinsert; } else { headnode ->left->llink = nodetoinsert; nodetoinsert->rlink = FirstLeft(headnode); headnode->left = nodetoinsert; } } int over_flow(struct node* nodetochk) { long int ovrflwdgt = 0; ovrflwdgt = nodetochk->data / 100000000; if(ovrflwdgt !=0) { nodetochk->data = nodetochk->data - (ovrflwdgt* 100000000); } return ovrflwdgt; } void Add(struct head* oprnd1,struct head* oprnd2,struct head* result) { struct node* n1,*n2 , *rslt; long int sum,ovrflwdgt = 0; if(Sign(oprnd1) == Sign(oprnd2)) { n1 = FirstRight(oprnd1); n2 = FirstRight(oprnd2); while(n1!=NULL && n2!=NULL) { sum = n1->data + n2->data + ovrflwdgt; rslt = new struct node; rslt->data = sum; InsertLeft(result,rslt); ovrflwdgt = over_flow(rslt); n1 = NextLeft(n1); n2 = NextLeft(n2); } while(n1 != NULL) { sum = n1->data + ovrflwdgt; rslt = new struct node; rslt->data = sum; InsertLeft(result,rslt); ovrflwdgt = over_flow(rslt); n1 = NextLeft(n1); n2 = NextLeft(n2); } while(n2 != NULL) { sum = n2->data + ovrflwdgt; rslt = new struct node; rslt ->data = sum; InsertLeft(result,rslt); ovrflwdgt = over_flow(rslt); n2 = NextLeft(n2); } if(ovrflwdgt > 0) { rslt = new struct node; rslt->data = ovrflwdgt; InsertLeft(result,rslt); } } }
Last edited by cscgal; Nov 13th, 2008 at 4:25 pm. Reason: Added code tags
No one here is likely to "do it for you". If you have a question, we'll be glad to answer.
Please read the sticky posts at the top of this forum, and place code tags around your program code, like:
[code]
your code goes here
[/code]
Please read the sticky posts at the top of this forum, and place code tags around your program code, like:
[code]
your code goes here
[/code]
Everyone's gotta believe in something. I believe I'll have another drink.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
![]() |
Similar Threads
- can someone plz help me with this? (Visual Basic 4 / 5 / 6)
- I NEED SUPPORT **"IMPORTANT"** PLZ HELP (Windows NT / 2000 / XP)
- Windows media player (Windows NT / 2000 / XP)
- Bridge.dll...Make it go away, Plz (Viruses, Spyware and other Nasties)
- can sum1 look @ dis plz (Viruses, Spyware and other Nasties)
- Hijackthis log file - plz help (Viruses, Spyware and other Nasties)
- IE not working...PLZ help :cry: (Web Browsers)
- PLZ help it's urgent! (Web Browsers)
- plz help ppl...... (Computer Science)
Other Threads in the C++ Forum
- Previous Thread: Problem adding in stack
- Next Thread: c++ STL LIST function
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamic email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






