fork download
  1. #include <algorithm>
  2. #include <iterator>
  3. #include <iostream>
  4. #include <sstream>
  5. #include <string>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. class file{ //class of program file
  11. private:
  12. istringstream File; //file
  13. vector<string> text; //code from file
  14. public:
  15. file(const string& path) : File(path) {
  16. for(string i; getline(File, i); text.push_back(i));
  17. }
  18.  
  19. void write() { //write the text file
  20. copy(cbegin(text), cend(text), ostream_iterator<string>(cout, "\n"));
  21. }
  22. bool no_zero(int cx ,int cy){
  23. if(text[cx][cy] != ' ') return true; //I change this string then
  24. else return false; //using the number of char
  25. //betwen 32 to 124 but number of'�'
  26. } //is -1
  27. char ret_char(int cx,int cy){
  28. return text[cx][cy];
  29. }
  30.  
  31. };
  32.  
  33. int main() {
  34. file a = file(" start:\n var: a , b , c;\n a = 4;\n b = 2;\n\n c = a + b;\n wuw c;\n end;/");
  35.  
  36. int u = 4;
  37. cout << a.ret_char(u,0) << endl;
  38. cout << a.no_zero(u,0);
  39.  
  40. a.write();
  41. }
Success #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout

1    start:
    	var: a , b , c;
    	a = 4;
    	b = 2;

    	c = a + b;
    	wuw c;
    	end;/