fork download
  1. #include <iostream>
  2.  
  3. class TestOfForVector {
  4. public:
  5. double* tabX;
  6. double* tabY;
  7. int n;
  8. TestOfForVector(int getN){
  9. n = getN;
  10. tabY = new double[n*n];
  11. //tabX = new double[n];
  12. for(int i = 0; i < n; i ++ ){
  13. for(int j = 0; j <n; j++){
  14. tabY[j+i*n] = 1.0;
  15. std::cout<<tabY[j+i*n]<<std::endl;
  16. }
  17. }
  18. }
  19.  
  20.  
  21. ~TestOfForVector(){
  22. delete [] tabX;
  23. delete [] tabY;
  24. }
  25. };
  26.  
  27.  
  28. int main()
  29. {
  30. TestOfForVector newboy(10); //it will be defined by user input;
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1