C++ language
Write a program that
1. generates a random integer between 100 and 1000, call the number N
2. reads a file name from the keyboard
3. opens a file for output using the file name from step 2
4. generates N random numbers between 1 and 100 and writes them to the file from step 3
5. closes the file
6. opens the file from steps 3, and 4 for input
7. reads the numbers from the file and finds the largest number in the file.
8. opens the file from step 3 again and counts the number of times the largest number appears in the file
9. displays the largest number and the number of times it appears with appropriate labels.
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
int seedVal=0;
//t is a 'time_t' type variable
time_t t;
seedVal = (unsigned) time (&t);
srand(seedVal);
//defines an input stream for the data file
ifstream dataIn;
//Defines an output stream for the data file
ofstream dataOut;
string filename;
//Declaring variable
int max=-999;
int random,count=0;
//Generate the random number
int N=rand()%(901) + 100;
//Getting the filename entered by the user
cout<<"Enter a filename:";
cin>>filename;
//Opening the input file
dataOut.open(filename.c_str());
//Generate N random number
for(int i=1;i<=N;i++)
{
random=rand()%(100) + 1;
//Writing to the output file
dataOut<<random<<endl;
}
//closing the output file
dataOut.close();
//creating and Opening the output file
dataIn.open(filename.c_str());
for(int i=1;i<=N;i++)
{
dataIn>>random;
if(max<random)
{
max=random;
}
}
//Closing the intput file
dataIn.close();
cout<<"The Largest number in the file is :"<<max<<endl;
//creating and Opening the output file
dataIn.open(filename.c_str());
for(int i=1;i<=N;i++)
{
dataIn>>random;
if(random==max)
{
count++;
}
}
dataIn.close();
//Displaying the output
cout<<"No of times largest number appears in the file is :"<<count<<endl;
return 0;
}
______________________
Output:

_____________Could you rate me well.Plz .Thank You
C++ language Write a program that 1. generates a random integer between 100 and 1000, call...
Write a program in c++ that generates a 100 random numbers between 1 and 1000 and writes them to a data file called "randNum.dat". Then re-open the file, read the 100 numbers, print them to the screen, and find and print the minimum and maximum values. Specifications: If your output or input file fails to open correctly, print an error message that either states: Output file failed to open Input file failed to open depending on whether the output or...
C language
Write a program that generates 20 random integers (ranging in between 0 to 100) and outputs all the even random numbers.
Please write in java program Write an application that generates 100 random integers between 1 and 75 and writes them to a file named "file_activity.txt". Read the data back from the file and display the following: The sum of the numbers in the file The average of the numbers in the file The numbers in the file in increasing order To sort an array: int[] arr = new int[20]; Arrays.sort(arr); -- this sorts an array To sort an ArrayList: ArrayList<Integer>...
Write a program that reads an unknown number (but no more than 100) of integer values from a file (“ass5_Q4_input.txt”), and displays distinct numbers. (i.e. if a number appears multiple times, it is displayed only once.)
please help me with, Write a program in java that generates 10 random doubles, all between 1 and 11, and writes them to a text file, one number per line. Then write another program that reads the text file and displays all the doubles and their sum accurate to two decimal places. SAMPLE OUTPUT 10.6269119604172 2.737790338909455 5.427925738865128 1.3742058065472509 1.1858700262498836 4.180391276485228 4.910969998930675 5.710858234343958 7.790857007373052 3.1806714736219543 The total is 47.13
A. Create a java program that generates 1000 random integers. Write the 1000 random integers to a file using the Formatter class. B. Create a second java program that opens the file with the 1000 integers using the Scanner class. Read in the integers and find and print out the largest, smallest and the average of all 1000 numbers. C. Repeat A from above but use the BufferedWriter class B. Repeat B from above but use the BufferedReader class.
c# prograaming language
1. write a program that generates 10,000 random integers in the
range of 0-9 and them in binary search tree.
2. use any sort algorithm (insertion, bubble, quick...) to
display a list of each of the integers and how many times they
appear.
3. at last, add ruction to the BinarySearchTree class that count
the number of edges in a tree.
Write a program that generates 10,000 random integers in the range of 0-9 and store them...
Programming C++ Language, PLEASE HELP, Will upvote Write a program that first generates two random decimal numbers within the range -100 to 100 inclusive. Next, generate a random number between 1 and 4 inclusive to correspond to each of our math operators (+, -, *, /). Finally, write out to a file called mathWorksheet.txt the following format: A o B = ? With A and B replaced by the two random numbers that were generated and o replaced by the...
Create a JAVA application which generates 20 random numbers between 1 and 100 and writes them to a text file on separate lines. Then the program should read the numbers from the file, calculate the average of the numbers, and display this to the screen.
1.Write a python program that writes a series of random numbers to a file named random.txt. Each random number should be in the range of 1 through 300. The application should let the user specify how many random numbers the file will hold. 2. Write another program that reads the random numbers from the random.txt file, displays the numbers, then displays the following data: I. The total of the numbers II. The number of random numbers read from the file