Search Results

Search found 1 results on 1 pages for 'ibnu syuhada'.

Page 1/1 | 1 

  • How To Parse String File Txt Into Array With C++

    - by Ibnu Syuhada
    I am trying to write a C++ program, but I am not familiar with C++. I have a .txt file, which contains values as follows: 0 0.0146484 0.0292969 0.0439453 0.0585938 0.0732422 0.0878906 What I have done in my C++ code is as follows: #include <iostream> #include <fstream> using namespace std; int main() { string line; ifstream myReadFile; myReadFile.open("Qi.txt"); if(myReadFile.is_open()) { while(myReadFile.good()) { getline(myReadFile,line); cout << line << endl; } myReadFile.close(); } return 0; } I would like to make the output of the program an array, i.e. line[0] = 0 line[1] = 0.0146484 line[2] = 0.0292969 line[3] = 0.0439453 line[4] = 0.0585938 line[5] = 0.0732422 line[6] = 0.0878906

    Read the article

1