Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <string>
- using namespace std;
- static void direct_line(ifstream& fin, int n, double *x, double *y) {
- string line;
- int c = 0;
- while (getline(fin, line))
- if (++c >= n) break;
- istringstream in(line);
- in >> *x >> *y;
- }
- int main() {
- double x, y;
- ifstream fin("dat");
- direct_line(fin, 10, &x, &y);
- fin.close();
- cout << x << ' ' << y << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement