why does this program run only till the first for loop and then stops?
It doesn't run the second for loop and also skips system("pause"). Can anyone explain what is wrong in my code? I want to make two arrays of strings: strgs1 and strgs2 of length a and b, and then take the input from the user for each element of the arrays. This is my code:
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string strgs1[a-1], strgs2[b-1];
for(int i = 0;i < a;i++){
cin>>strgs1[i];
}
for(int j = 0;j < b;j++){
cin>>strgs2[j];
}
system("pause");
return 0;
}