Answer to Question #20738 in C++ for ahmed
2012-12-18T10:56:36-05:00
write aprogram to read tow numbers at atime from the file and print the product to another file
1
2012-12-20T07:43:50-0500
#include <cstdlib> #include <iostream> #include <fstream> using namespace std; int main() { & FILE *f; int dat; & srand(time(0)); & int n=rand()%30; & cout << "File name? "; & char s[20]; & cin>>s; & f=fopen(s, "wb"); & for (int i=1; i<=n; i++) & { dat = rand()%101 - 50; cout << dat << " "; fwrite(&dat, sizeof(int), 1, f); & } & cout << endl; & fclose(f); system("PAUSE"); return EXIT_SUCCESS; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment