Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)

 ckmelissa86 10Oct2007 19:12

hi,i'm Melissa from Malaysia.. I'm a Uni student and i got problem with link list programming.Hope that you can help me to solve it

Well, now i need to write a program which using link list to make a calculator.

The concept which i plan to do is that.. 3 digit save in 1 node in reverse order.. then when we need to do some math operation like addition or subtraction.. the operation if execute in the reverse order..

Hope you guys will help me .. and hope i can get ur reply soon...

Take care and all the Best

Best regard:
Melissa

 seeguna 15Oct2007 11:23

Post ur trying code so that i will rectify ur problem

 ckmelissa86 18Oct2007 16:27

Code:

```//libraries #include<iostream.h> #include<conio.h> void main() { //declare the variables     int i[3][10];   char c[2][10];   int bil; //promt the user to enter the number   cout<<"Masukkan bilangan digit : ";   cin>>bil; //loop for enter 2 difference number   for(int y=0;y<2;y++)   {         //loop for enter the number        for (int x=bil-1;x>=0;x--)       {       cin>>c[y][x];       }   } //loop for convert the 2 numbers into int   for(int y=0;y<2;y++)   {       for (int x=bil-1;x>=0;x--)       {       i[y][x]=(int)c[y][x];       }   } //Display result     for(int y=0;y<2;y++)   {       for (int x=bil-1;x>=0;x--)       {       cout<<i[y][x]<<"  ";       }  cout<<endl;   }  //this part not understand int b=0;       for (int x=bil-1;x>=0;x--)       {       i[2][x]=i[0][x]+i[1][x]+b;       if(i[2][x]>10)         {           i[2][x]=i[2][x]-10;           b=1;           }       else           b=0;       } //Display result       for (int x=0;x<bil;x++)       {       cout<<i[2][x]<<"  ";       }    getch();   }```
this is the rough coding i did.. but this is only for addition..i am still trying to do for subtraction

Thx for helping

 DaWei 18Oct2007 19:31

Read the "Before you make a query" thread, particularly with regard to the use of code tags.

 seeguna 19Oct2007 11:18