#include
using namespace std;
int main()
{
cout << \"Do you need to encrypt or decrypt?\" << endl;
string message;
getline
You want to use message.size() not sizeof(message).
sizeof just gives the number of bytes in the data type or expression. You want the number of characters stored in the string which is given by calling size()
Also indexing starts at 0, notice I changed from 1 to 0 below.
for (int place = 0; place < message.size(); place++)
{
letter2number = static_cast(message[place]);
cout << letter2number << endl;
}
Any pointer on an x86 system is only 4 bytes. Even if it is pointing to the first element of an array on the heap which contains 100 elements.
Example:
char * p = new char[5000];
assert(sizeof(p) == 4);
Wrapping p in a class or struct will give you the same result assuming no padding.