
Write a program in C++ that finds the count of a number in a list of integers from a text file named input.txt.
- The output will be written to ouput.txt and will count up to the largest number in the list and display how many times each number appears.
- The program must first check if input.txt exists.
- The maximum /minimum and total amount will be displayed.
- You must use functions (the more functions you use, the easier it will be to debug).
- Add comments to your code thoroughly explaining the logic.
- Libraries you may use: #include <iostream>, #include <string>, #include <fstream>, #include <iomanip>, #include <cmath>, #include <vector>, #include <ctime>
- You may use
Ex:


Step by stepSolved in 5 steps with 4 images

- In C++, define an integer vector and ask the user to give you values for the vector. Because you used a vector, so you don't need to know the size. user should be able to enter a number until he wants(you can use while loop for termination. for example if the user enters any negative number, but until he enters a positive number, your program should read and push it inside of the vector). the calculate the average of all numbers he entered.arrow_forwardIn C language / Please don't use (sprint) function. Write a function fact_calc that takes a string output argument and an integer input argument n and returns a string showing the calculation of n!. For example, if the value supplied for n were 6, the string returned would be 6! 5 6 3 5 3 4 3 3 3 2 3 1 5 720 Write a program that repeatedly prompts the user for an integer between 0 and 9, calls fact_calc and outputs the resulting string. If the user inputs an invalid value, the program should display an error message and re-prompt for valid input. Input of the sentinel -1 should cause the input loop to exit. Note: Don't print factorial of -1, or any number that is not between 0 and 9. SAMPLE RUN #4: ./Fact Interactive Session Hide Invisibles Highlight: None Show Highlighted Only Enter·an·integer·between·0·and·9·or·-1·to·quit:5↵ 5!·=·5·x·4·x·3·x·2·x·1·x··=·120↵ Enter·an·integer·between·0·and·9·or·-1·to·quit:6↵ 6!·=·6·x·5·x·4·x·3·x·2·x·1·x··=·720↵…arrow_forwardIn C++ coding please 13.4 Programming 4: Binary Conversion In this assignment you will read in a string of 0's and 1's, you will then convert this to its decimal integer value and print that value on a single line (ending with a newline). For example: INPUT:0010 OUTPUT:2arrow_forward
- C++ please and thank you. In this assignment you will identify the word and word combinations associated with telephone numbers by using the word list contained in a file with over 264,100 words. Each word ranges from 2- 12 letters. 1 You will extract from this file and store all the three and four-letter words. 2 You will accept, from user input, a phone number as a string. Then you will validate that the phone number is in the correct format and contains valid numbers. If the phone number is not valid, you should display the message "Invalid phone number" and exit. 3 Using the phone number, you will determine all the corresponding words and word combinations and write them into a file named "output.txt". Note: A phone number must be in the format ###-#### and contain only the digits [2-9] inclusive to be considered valid. The digits 1 and 0 are considered invalid because they are not associated with any letters. Example input: 223-5653 The output.txt file should…arrow_forwardI know you are using AI. I said multiple times that don't give me AI generated answer or plagiarised answer. If I see these things I'll give you multiple downvotes and will report immediately.arrow_forwardWrite code in C++ There are two scientists working on set of numbers. The first person is looking for two numbersspecifically. The second person is responsible for entering all data. Help the first person to know ifthe numbers set entered by the second person includes the two numbers he is looking for!InputThe first person shall enter two numbers. The second person enters set of numbers of any size. S/hecan enter any range of numbers (up to you how to read those numbers).OutputMessage showing if both numbers entered by the first person have been found or not. If one of thenumbers was found show which one has been found. Hint: you may need to use flag-controlled loop.arrow_forward
- Write a program in C++ that finds the count of a number in a list of integers from a text file named input.txt. The output will be written to output.txt and will count up to the largest number in the list, displaying how many times each number appears. The program must first check if input.txt exists. The maximum, minimum, and total amount will be displayed. You must use functions for better organization and debugging. Add comments to your code thoroughly explaining the logic. Libraries you may use: #include , #include , #include , #include , #include , #include , #include You may use vectors, arrays, and searching & sorting methods Example: input.txt: 5, 2, 8, 3, 6, 8, 2, 7, 4 output.txt: 2:** (2) 3:* (1) 4:* (1) 5:* (1) 6:* (1) 7:* (1) 8:** (2) Max: 8 Min: 2 There are 9 numbers.arrow_forwardin the C++ version please suppose to have a score corresponding with probabilities at the end and do not use the count[] function. Please explain the detail when coding. DO NOT USE ARRAY. The game of Pig The game of Pig is a dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - if the player rolls 1: the player scores nothing and it becomes the opponents turn. 2 - 6: the number is added to the player's turn total and the player's turn continues. hold - The turn total is added to the player's score and it becomes the opponent's turn. This game is a game of probability. Players can use their knowledge of probabilities to make an educated game decision. Assignment specifications Hold-at-20 means that the player will choose to roll…arrow_forwardWrite a C++ program: Ask user to give you a list of the numbers and then Sort them, by calling two functions: Asc(Sort in Ascending order), and Desc(Sort in Descending order): Do it by pointer.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





