Translate one string to another

My assignment is relatively simple-- I receive an input in one "language" and must output it in another. However, it becomes much more tricky because one character does not necessarily translate to a single character. For example: 3d// should translate to DDD.

My problem is, I don't know how one would take a string and evaluate it one character at a time. We haven't learned much yet in the class so I doubt a solution could be too complex. The two functions we were given to use are as follows:
bool isMotionMeaningful(string motion) int translateMotion(string motion, string& instructions, int& badBeat)

I'm not looking for any form of solution just how do I approach this project?
An std::string object can use the square bracket element access operator "[]" to access individual elements as you would with an array, it is NOT an array though. So:
1
2
std::string Test = "Test";
std::cout << Test[0];

Would output 'T'. The header file "cctype" gives you a list of functions that evaluate characters to see if they are letters or numbers: http://www.cplusplus.com/reference/cctype/
To take one string and evaluate it "one character at a time", you make use of for-loops and access each character by indexing into the string:

1
2
3
string name = "Andrew";
for (int k = 0; k < name.size(); ++k)
    std::cout << name[k] << ' ';

Topic archived. No new replies allowed.