**Program must be written in Pascal**
There are 1 to N non-intersecting circles (where N be any number between 2 and 10). Start at circle 1 and randomly choose among the out arrows (all out arrows should be equally likely to be picked). The next circle is the new current circle. Each visited circle gets a "check mark" to indicate it has been visited. Once all circles have at least one check mark, stop the game. Write a program that will read from a textfile and write to another textfile. The input file will have N and K positive integers, where: N is the FIRST LINE and K is the SECOND LINE indicating number or arrows between the circles. The next K lines indicate the arrows. Each arrow line consists of two numbers, each number being one of circles in the game. These two numbers are separated by a single blank. The first number designates the circle that is the source (back end) of the arrow; the second number designates the circle that is the destination (pointed end) of the arrow. Note: If the text in the input file does not follow the format described above, your program should end with an error message to the screen and to an output file. At the end of the game, print out to the screen AND to the output textfile, the following numbers:
1. The number of circles that were used for this game
2. The number of arrows that were used for this game
3. The total number of checks on all the circles combined.
4. The average number of checks in a circle marked during the game.
5. The maximum number of checks in any one circle.
var fin,
gout:text;
x:stringout;
begoutin
assigoutn(fin, 'in.txt');
assigoutn(gout,'out.txt');
x:='d:\pascal\dosare\in.txt';
rewrite(fin);
write(fin,x);
x:='';
reset(fin);
rewrite(gout);
while not eofin(fin) do begoutin
readln(fin,x);
writeln(gout,x);
end;
close(fin);
close(gout);
readln;
end.
What
**Program must be written in Pascal** There are 1 to N non-intersecting circles (where N be...
Write a C++ program to find the kth largest number among N numbers. You may assume 0 < k <= N. The numbers are in an input file. Input value of k from the user. Read the first k numbers into an array and sort them into non-increasing order. Next, read the remaining numbers one by one (until end-of-file). As a new number is read, if it is smaller than the number in position k-1 in the array, it is...
C++ Class and Operator Overloading part 1 The source file contains a C++ program that declares and initializes an array of Circles. The program is using a for loop statement to find the largest circle in the array and display it on the output screen. However, the program is currently not working. The problem is the program uses logical operator ' > ' for comparison of circles and it is not working unless we overload such operator for the class...
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...
This C++ Programs should be written in Visual studio 2017 PROGRAM 1: Comparing Using Arrays to Using Individual Variables One of the main advantages of using arrays instead of individual variables to store values is that the program code becomes much smaller. Write two versions of a program, one using arrays to hold the input values, and one using individual variables to hold the input values. The programs should ask the user to enter 10 integer values, and then it...
C Language program. Please follow the instructions given. Must use functions, pointers, and File I/O. Thank you. Use the given function to create the program shown in the sample run. Your program should find the name of the file that is always given after the word filename (see the command line in the sample run), open the file and print to screen the contents. The type of info held in the file is noted by the word after the filename:...
2. In a file called passfail.py, write a Python program to solve the following problem: Given a file students.txt with the following information for a stu dent: student number, average quiz mark, average assignment mark, midterm exam mark, and final exam mark (where each mark is recorded out of 100), de termine if the student has passed or failed based on the following information A student will pass the course if they have a passing mark (50% or higher) for...
python question
2. In a file called passfail.py, write a Python program to solve the following problem: Given a file students.txt with the following information for a stu dent: student number, average quiz mark, average assignment mark, midterm exam mark, and final exam mark (where each mark is recorded out of 100), de termine if the student has passed or failed based on the following information: • A student will pass the course if they have a passing mark (50%...
In this lab you will implement tickets-for-seat-management system. The basic idea is that your program reads an event number and seat number request from a user, and determines if the seat is available (and marks it taken if it was), or is unavailable (so asking the user to choose again). As part of that exercise, you’ll be working with a file of “canned” requests to exercise your program. That is, instead of typing the requests in to your program, the...
This program will reinforce our knowledge on basic ‘C’ program control, arrays, and editing and compiling ‘C’ programs. The objective of this assignment is to create a program that tallies a shopping list of items and displays each selected item, item cost, and total cost of all the selected items plus tax. The program will setup a simple sporting goods store with a few items and prices. The user will submit a shopping list in a textfile and submit it...
C++ requirements The store number must be of type unsigned int. The sales value must be of of type long long int. Your program must properly check for end of file. See the section Reading in files below and also see your Gaddis text book for details on reading in file and checking for end of file. Your program must properly open and close all files. Failure to follow the C++ requirements could reduce the points received from passing the...