Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include using namespace std; int main(){ string myfile; //string class cout < > myfile; //type in ofstream outputfile; outputfile.open(file.txt); //srand(time(NULL)); for ( int

#include

#include

#include

using namespace std;

int main(){

string myfile; //string class

cout <<"Enter file name: "; // output

cin >> myfile; //type in

ofstream outputfile;

outputfile.open("file.txt");

//srand(time(NULL));

for (int i=0; i<1000;i++ ){ //random numbers

outputfile<<(1+rand()% 1000)<

}

cout << "Ramdom number: "<< myfile <

outputfile.close(); //close the file

return 0;

}

do this code to the read file .

C++ - Read from a file.

(Function Organized Code is Ok)

Read the [1000 random integers] for .txt File into a file buffer multiple each output by 10 and output to the console.

Implement a file buffer.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago