Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream.h>
- #include <iomanip.h>
- #include <stdlib.h>
- int main()
- {
- float output;
- ifstream fin("4.dat");
- ofstream fout("4-1.dat");
- float c[10000], plot[100];
- int i,x;
- for(i=0; i<10000; i++)
- {
- c[i]=rand()%1000;
- c[i]=c[i]/100-5;
- }
- for(i=0;i<100;i++)
- plot[i]=0;
- for(i=0;i<10000;i++)
- {
- x=(c[i]+5)*10+1;
- plot[x]++;
- }
- for(i=0;i<100;i++)
- fout<<-5+0.1*i<<"\t"<<0.0001*plot[i]<<"\n";
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment