60 626
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #20738 in C++ for ahmed

Question #20738
write aprogram to read tow numbers at atime from the file and print the product to another file
Expert's answer

#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions