1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string.h>
#include <conio.h>
#include <string>
using namespace std;
double *loadData(string fileName){
ifstream file(sFile, ios::in);
if(! file){
cout << "Erreur d'ouverture du fichier!" << endl;
return (NULL);
}
string s;
stringstream sStream;
// Read Data line by line
while (getline(file, s)){
sStream << s << " ";
s.erase();
}
// Variable out
int *data = new int [600];
for(int j = 0; j < 600; j++){
sStream >> data[j] ;
}
// free memory
s.erase();
sStream.str("");
sStream.clear();
file.close();
return(data);
}
void main(){
double *data = loadData("download.txt");
int size = 600;
int i = 0;
while(i < size - 1){
cout << data[i] << "\t" << data[i + 1] << endl;
}
system("PAUSE");
} |
Partager