1. ## Newblet Question(s)

So I'm trying to figure out how to dynamically create an array.
I heard I could do this by using a pointer (dereferencing operator? is that a pointer, are there any other types of pointers?)
Like so?
Code:
```while (ch)
{
ii++;

numbers[p] = ch;
*p = ii;
}```
I'm trying to segment out an input into an array so I can do stuff with it. Would that code redimension the array indefinately while input was not empty?

Sorry, I'm still getting used to manipulation of data in c++.

2. Perhaps a vector would better suit you? It's like an array, but it grows without you handling the memory allocation.
http://www.parashift.com/c++-faq-lit....html#faq-34.1

3. Um, I'm not looking for a hetrogenous container.

For example... I'm hoping to expand this into an arbitrary precision calculator. So I'm learning string manipulation functions and how to feed it into an array.

For example I entered this:
1111111111111 * 1111111111111

The answer is of course: 1234567901234320987654321

But, that would overload most of the primitive data types.

So I'm taking this in small steps.
First I figure out how to segment out input into an array.
So lets say I cined a random number:
123456789
and wanted to check if it was divisible by nine using a method I used in grade school (sum all the numbers and see if that is a multiple of 9)
So I need to pull out each index of that int variable
and feed it into an array, sum the contents of that array, divide by nine and then check to see if that is a whole number thus giving me a program which will evaluate a function which I learned in third grade.

Some might ask why I don't just use a modulus. Its because I can't stand the %. It looks like its staring at me man... really creeps me out.

I'll read up a bit more on the container classes.

4. Using char arrays is certainly a common (only?) way to deal with huge numbers. In C++ to allocate your own memory on the fly you use the new or new[] operator and release the memory with the delete or delete[] operator. In C you would use the malloc and free keywords.

However, why not use std::string to store the representation of a huge number and spare yourself the hassle of handling your own memory allocation?

5. you can still use a vector<int> or maybe better a vector<long long>, whenever you overflow you just push_back the overflow on the vector and not have to worry about dynamic allocation and deletion (actually, I'd recommend deque over vector, especially if your numbers will grow pretty big as hit handles reallocation a lot better)

Using string as suggested is an easy method especially for beginners, but it will be much slower because of all the conversion back and forth.

If you'd like, i'd be more than willing to show you some of my large integer code.

Disclaimer. I oversimplified the overflow part above, there's actually a lot of detail in that you actually don't want your variable to overflow.

6. Originally Posted by KyussWren
Some might ask why I don't just use a modulus. Its because I can't stand the %. It looks like its staring at me man... really creeps me out.
Gee, I hate the =, it looks mean to me. How can I get around not using it?

7. ohnononono!
I don't know how not to use the =.
I would guess you could black box it a bit. Maybe open up the language files if you were using Kdev or something and edit it...
but I haven't really experimented with language modification.
If I had, I would probably modify my IDE to make my source code self documenting .
Now that would be a feat.

8. Code:
```// StringtoDecimalArray.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include <iostream>
#include <string>

using namespace std;

const int MAX_ARRAY_SIZE = 200;

int CharToDigit( char );
void Output(int[], int);

int main()
{
int* number;
string inputNumber;

cout << "Enter an arbitrary precision number" << endl;
cin >> inputNumber;

number = new int[ inputNumber.length() ];

for ( unsigned ii = 0; ii < inputNumber.length(); ii++)
{
number[ii] = CharToDigit(inputNumber[ii] );
}//for

Output(number, inputNumber.length());

delete [] number;

getch();
return 0;
}

int CharToDigit( char argument )
{
return(static_cast<int>(argument) - 48 );
} //CharToDigit

void Output( int array[], int nbOfElements)
{
//for (unsigned ii = 0; ii < nbOfElements; ii++)
for (int ii = nbOfElements + 1 ; ii > 0; ii--)
{
cout << array[ii - 1] << endl;
}//for
}//output```
and here is the code I came up with so far.