Hi guys,im having a class project and i need ur help,
i need to make a class called "BigInt"
BigInt::BigInt(string digits) in which digits have to be digits or else u report error,
how can i convert that string into an array or vector or smth like that, so i can check them if they are not letters inputed?
i tried with smth like this
BigInt::BigInt(string digits)
{
int n = digits.length();
int t = 0;
while (t < n) {
if (digits[t] != 0 || digits[t] != 1 || digits[t] != 2 || digits[t] != 3 || digits[t] != 4 || digits[t] != 5 || digits[t] != 6 || digits[t] != 7 || digits[t] != 8 || digits[t] != 9){
cout << "error";
break;
}
t++;
}
}
Should i make another method that converts that string into an dynamic array of ints ( i dont know at the start how many digits does the number have) and how should that be made?
tnx!didn`t know about that command,sorry im kinda new in c++,
Do u know how to convert the string into array is there some kinda command can be used?
do u suggest using lists or using vectors?
in my task i need to multiply divide compare add substract the numbers.