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
|
Go4Expert Member
|
![]() |
| 15Oct2007,11:23 | #2 |
|
Post ur trying code so that i will rectify ur problem
|
|
Newbie Member
|
|
| 18Oct2007,16:27 | #3 |
|
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();
}
Thx for helping Last edited by DaWei; 18Oct2007 at 19:30.. Reason: Added code tags. |
|
Team Leader
|
![]() |
| 18Oct2007,19:31 | #4 |
|
Read the "Before you make a query" thread, particularly with regard to the use of code tags.
|
|
Go4Expert Member
|
![]() |
| 19Oct2007,11:18 | #5 |
|
hi,
I just go thru ur coding, What u did is "Read some characters in an array, Convert that character array as Integer array and finally u add the integers values present in it".... i..e very basic program Where is ur Linked list problem? I think that u sent something else..... If u clearly explain ur problem means i m ready to solve it.............. |


