fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. void as(vector<string> &p, int n, int m)
  7. {
  8. p.resize(n);
  9. int i, j;
  10. for (i = 0; i < n; i++) {
  11. p[i].resize(m);
  12. for (j = 0; j < m; j++)
  13. {
  14. cout << "p[" << i << "][" << j << "]=";
  15. cin >> p[i][j];
  16. }
  17. }
  18. }
  19.  
  20. int main()
  21. {
  22. vector<string>a;
  23. as(a, 3, 3);
  24. cout<<endl;
  25. for (int i=0; i<3; i++)
  26. cout << a[i] << endl;
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 16064KB
stdin
abcDEFghi
stdout
p[0][0]=p[0][1]=p[0][2]=p[1][0]=p[1][1]=p[1][2]=p[2][0]=p[2][1]=p[2][2]=
abc
DEF
ghi