I have some old code that figures out Qfactors for me, now I need help on porting it over to Linus to do some speed test on the Linus computers.
I been deep in FoxPro 5 for the last year ( the pain!) and now starting this little project.
Here is the code if you would please point out the place that need to change.
Code:#include <stdio.h> #include <time.h> // basic file operations #include <iostream> #include <fstream> // using namespace std; int y; double z; void print(const int *v, const int size, ostream &outfile) { y=y+1; if (y == 1000000) { printf ("%15.0f\n",z); y=0; } if (v != 0) { for (int i = 0; i < size; i++) { outfile << v[i]; outfile << ","; } outfile.setf(ios::fixed,ios::floatfield); outfile << z; outfile << "\n"; z=z+1; } } // print void visit(int *Value, int N, int k, ostream &ofile) { static level = -1; level = level+1; Value[k] = level; if (level == N) print(Value, N, ofile); else for (int i = 0; i < N; i++) if (Value[i] == 0) visit(Value, N, i, ofile); level = level-1; Value[k] = 0; } main() { const int N = 16 ; int Value[N]; time_t t; time_t t1; z = 1; t = time(0); double dif; ofstream myfile; myfile.open ("16Count.txt",ios::app); myfile.setf(0,ios::floatfield); // floatfield not set myfile.precision(0); printf("Start time is %s", ctime(&t)); myfile << "Start time is "; myfile << ctime(&t); myfile << "\n"; for (int i = 0; i < N; i++) { Value[i] = 0; } visit(Value, N, 0, myfile); t1 = time(0); printf("End P1 time is %s", ctime(&t1)); myfile << "End P1 time is %s"; dif = difftime(t1,t); printf("End time is %.2lf.\n ", dif); myfile << dif; myfile << "/n"; myfile.close(); printf("Push any key to exit.\n "); return 0; }



LinkBack URL
About LinkBacks



