i've been working on a program that extends the limit of an integer using arrays
here is my code so far

#include<iostream>
#include<string>

using namespace std;

void sub();
void add();
void mult();

int main()
{	
	int operation;
	cout<<"Please Enter a number"<<endl<<"1.Addition"<<endl<<"2.Subtraction"<<endl<<"3.Multiplication"<<endl<<endl;
	cin>>operation;
	
	if(operation == 1)
	{
		add();
	}
	if(operation == 2)
	{
		sub();
	}
	if(operation == 3)
	{
		mult();
	}
	int x; cin>>x;
	return 0;
}

void add()
{
	char s_num1[999],s_num2[999],s_ans[999];
	int k=0, i,j,p,l1,l2; 
	int tens=0, ones,ans;
	int v=0;

	cout<<"Enter The First number"<<endl;
	cin>>s_num1;
	cout<<"Enter The Second number"<<endl;
	cin>>s_num2;
	
	for(l1=0;s_num1[l1]!='\0';l1++);
	for(l2=0;s_num2[l2]!='\0';l2++);
	l1--;
	l2--;
for(i=l1,j = l2;(i>=0)&&(j>=0);i--,j--){
		ans = (int) s_num1[i] + (int) s_num2[j] + tens - 2*48;
		ones=ans%10;
		tens=ans/10;
		s_ans[k] = ones + 48;
		k++;
	}
	while(i>=0){
		ans = tens + (int) s_num1[i] -48;
		ones=ans%10;
		tens=ans/10;
		s_ans[k] = ones + 48;
		k++;
		i--;
	}
				
	while(j>=0){
		ans = tens + (int) s_num2[j] -48;
		ones=ans%10;
		tens=ans/10;
		s_ans[k] = ones + 48;
		k++;
		j--;
	}
	if(tens!=0)
		s_ans[k++] = tens+48;
	for(p=k-1;p>=0;p--)
		cout<<s_ans[p];
}


void sub()
{
	int l1, l2,j,i,v=0,p;
	char s_num2[999],s_num1[999];
	int list[10000];

	cout<<"Enter The First number"<<endl;
	cin>>s_num1;
	cout<<"Enter The Second number"<<endl;
	cin>>s_num2;
	
	for(l1=0;s_num1[l1]!='\0';l1++);
	for(l2=0;s_num2[l2]!='\0';l2++);
	l1--;
	l2--;
	
	for(i=l1, j = l2;(i>=0)&&(j>=0);i--,j--)
	{
		list[v] = s_num1[i] -  s_num2[j];
		if(list[v]<0)
		{ 
			list[v] = s_num1[i] -  s_num2[j]+10;
			s_num1[i-1]=s_num1[i-1]-1;
		}
		v++;
	}
	for(;(j<0)&&(i>=0);)
	{	
		list[v]=s_num1[i] -  '0';
		v++;
		i--;
	}
	for(p=0; p<v;v--)
	{
		cout<<list[v-1];
	}
}

void mult()
{
	//workin
}
}

now ive been using character array changing numbers like 2326 into list[]='2','3','2','6'. It has worked ok for addings and subbin but now i need to multiply two inputs....

SO HERES WHERE IM STUCK! I want to turn a input of a number such as 23123, into integer(not charaters)
list[0]=2
list[1]=3
list[2]=1
list[3]=2
list[4]=3
and i have no clue how to do it.... helps!

but why are you taking the numbers into char arrays?

cause it was the only way i could think of to put single numbers into each array to compute numbers such as

28193712987128937219878129378921738921739812 + 1289378129738912738921738921738921738

May be you can try using some of the standard lib methods like strtol,strtod, strtoul etc. i'm not sure which will be sufficient for this range of numbers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.