Q:

Making a calculator that translates a string to ints and chars

I'm working through a list of practice problems to beef up my C++ skills (I'm a beginner), this one is stumping me. 

Make a program that takes input from the user of a calculation (e.g. "2+2") and outputs the 
  answer (e.g. 4). It shouldn't matter if there are spaces or the formatting of the user's 
  input, so long as the basics (2 numbers and one connecting function) are fulfilled.

I think I have the basic idea down, I just don't understand two critical parts:
1) How take the input from the user as a string and put it into an array.
2) How to take members of an array and reconfigure them as a string.

A:

Because you seem to have an idea what you want to do, I'll just answer the questions. Go ahead and try. :)
To read from the console in C++ you can include the iostream-library and use cin <<.
For example:
#include <iostream>
#include <string>

int main(void)
{
 string yourVar;
 // ...  
 cin >> yourVar;
 //...
}

You should then be able to use the string like an array e.g. char c = yourVar[2];

