#include"TCanvas.h" #include"TF1.h" #include"TROOT.h" #include"TMath.h" #include"TGraph.h" #include"TH1.h" void sample() { ifstream mydat("test2.txt"); TCanvas* c1 = new TCanvas("c1","Graph"); float x,y; TH1F *hist = new TH1F("hist","Histogram",5,0.5,5.5); while(!mydat.eof()) { mydat >> x >> y; hist->Fill(x,y); } hist->SetMarkerStyle(3); hist->Draw(); mydat.close(); }