ALpMontana
КЯaL´da TaNıMaM КuяaL´da
C++ dosyaya kayıt süresi ve okuma süresi ölçme
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream dosya1;
ofstream dosya2;
time_t start,end;
double dif;
int sayi;
dosya2.open("d://text.txt");
time (&start);
for(int i=0; i<400000; i++)
{
dosya2<<rand()<<endl;
}
dosya2.close();
time (&end);
dif = difftime (end,start);
cout<<"Dosyaya kayit suresi : "<<dif<<"sn"<<endl;
dosya1.open("d://text.txt");
time (&start);
while(!dosya1.eof())
{
dosya1>>sayi;
}
time (&end);
dif = difftime (end,start);
cout<<"Dosyadan kayit okuma suresi : "<<dif<<"sn"<<endl;
return 0;
}
sapasaglamdır ßen yazdım cunku.:melek
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream dosya1;
ofstream dosya2;
time_t start,end;
double dif;
int sayi;
dosya2.open("d://text.txt");
time (&start);
for(int i=0; i<400000; i++)
{
dosya2<<rand()<<endl;
}
dosya2.close();
time (&end);
dif = difftime (end,start);
cout<<"Dosyaya kayit suresi : "<<dif<<"sn"<<endl;
dosya1.open("d://text.txt");
time (&start);
while(!dosya1.eof())
{
dosya1>>sayi;
}
time (&end);
dif = difftime (end,start);
cout<<"Dosyadan kayit okuma suresi : "<<dif<<"sn"<<endl;
return 0;
}
sapasaglamdır ßen yazdım cunku.:melek