I am working on a programming assignment in which we are making our own BigNum class. One of the constructors needs to be set up so that it can take a number from a string (i.e. 342567) and reads it into an array. However if the number were 0000000342567 it would have to be able to skip over the 0s and just read 342567.
Where is what i have so far but am lost on trimming the 0s
BigNum::BigNum(const char strin[])
{
size_t size = strlen(strin);
positive = true;
capacity = size;
digits = new size_t[capacity];
used=0;
while(used<size)
{
if(strin[size - used -1] =='-')
{
positive = false;
size --;
}
else if(strin[size - used -1] =='+')
{
size --;
}
else
{
digits[used] = strin[size - used -1] - '0';
used++;
}
}
}
Here is the assignment description if it helps http://csel.cs.colorado.edu/%7Eekwhite/CSCI2270Fall2011/hw2/Homework2.pdf