I made a thread yesterday and I was told that I went out of the array limit, but when I test it with an int type array it works so I think it's becuase it is a string array. My question is is there any special way to cin string arrays?
(I'm trying to make a program that can add entries to a string type array so if there is a better way than what I'm doing feel free to post it.)
Thanks in advance!
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
#include <string>
usingnamespace std;
int main() {
int n=2;
string A[n];
n++;
cin>>A[n-1];
}
The problem is that I need to change the size of the array with 1 so that I can add a new entry therefore n can't be const, also i'm using a loop it's just that I wanted to make it simple so that you can find the mistake easier.