
Hi, I need to solve this question using C++
Note: I have included Program - 5-23, General Program Format Rules, if you needed.
Program 5-23
// This program tests for file open errors.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inputFile;
int number;
// Open the file.
inputFile.open("BadListOfNumbers.txt");
// If the file successfully opened, process it.
if (inputFile)
{
// Read the numbers from the file and
// display them.
while (inputFile >> number)
{
cout << number << endl;
}
// Close the file.
inputFile.close();
}
else
{
// Display an error message.
cout << "Error opening the file.\n";
}
return 0;
}
Question:



Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

- Project 8 Specifications Using OOP, write a C++ program that will read in a file of names and a file of birth years. The file of names is called Names.txt and the file of birth years is called BirthYear.txt. Both input files should be located in the current directory of your program. The list of names in the Names.txt file corresponds to the list of birth years in the BirthYears.txt file. This means:The first name in the names.txt file corresponds to the first birth year in the birthyear.txt file. The second name in the names.txt file corresponds to the second birth year in the birthyear.txt file...and so on.Read in and store the names into an array of 30. Next read in and store the birth years into another array of 30 integers.Sort the arrays using the selection sort or the bubblesort code found in your textbook. List the roster of names in ascending alphabetical order displaying their birth years beside their names.Next, prompt the user to enter a birth year. Validate this…arrow_forwardflowchrt for the code below //C++ Code #include<iostream>#include<fstream>using namespace std;/*Create a global variable of type ofstream for the output file*/ofstream outfile; /** This function asks the user for the number of employees in the company. This value should be returned as an int. The function accepts no arguments (No parameter/input).*/int NumOfEmployees();/** accepts an argument of type int for the number of employees in the company and returns the total of missed days as an int. This function should do the following:Asks the user to enter the following information for each employee:The employee number (ID) (Assume the employee number is 4 digits or fewer, but don't validate it).The number of days that employee missed during the past year.Writes each employee number (ID) and the number of days missed to the output file */int TotDaysAbsent(int numberOfEmployees);/* calculates the average number of days absent.The function takes two arguments:the number of…arrow_forwardHow do you write a code in c++ that gives the user an option to save(write) a program(example the program arranges numbers in ascending order) onto a text file.arrow_forward
- User Input Program and Analysis (Last answer to this question was incorrect.) Demonstrate an understanding of C++ programming concepts by completing the following: Program: Create a C++ program that will obtain input from a user and store it into the provided CSC450_CT5_mod5.txt Download CSC450_CT5_mod5.txtfile. Your program should append it to the provided text file, without deleting the existing data: Store the provided data in the CSC450_CT5_mod5.txt file. Create a reversal method that will reverse all of the characters in the CSC450_CT5_mod5.txt file and store the result in a CSC450-mod5-reverse.txt file. Program Analysis: Given your program implementation, discuss and identify the possible security vulnerabilities that may exist. If present, discuss solutions to minimize the vulnerabilities. Discuss and identify possible problems that can result in errors for string manipulation of data. Your analysis should be 1-2 pages in length. TXT FILE INFORMATION (Txt file should NOT…arrow_forwardqerwr2arrow_forward// Flowers.cpp - This program reads names of flowers and whether they are grown in shade or sun from an input // file and prints the information to the user's screen. // Input: flowers.dat. // Output: Names of flowers and the words sun or shade. #include <fstream> #include <iostream> #include <string> using namespace std; int main() { // Declare variables here // Open input file // Write while loop that reads records from file. fin >> flowerName; // Print flower name using the following format //cout << var << " grows in the " << var2 << endl; fin.close(); return 0; } // End of main functionarrow_forward
- Hi, I need to solve this question using C++ programming language. Thank you. Note: I have included Program - 5-23, General Program Format Rules, if you needed. Program 5-23 // This program tests for file open errors. #include <iostream> #include <fstream> using namespace std; int main() { ifstream inputFile; int number; // Open the file. inputFile.open("BadListOfNumbers.txt"); // If the file successfully opened, process it. if (inputFile) { // Read the numbers from the file and // display them. while (inputFile >> number) { cout << number << endl; } // Close the file. inputFile.close(); } else { // Display an error message. cout << "Error opening the file.\n"; } return 0; } Pract3.txt…arrow_forwardThanks for the code, can you help me fix this two errors, i dont know how to do it.arrow_forwardpseudo code for the code //C++ Code #include<iostream>#include<fstream>using namespace std;/*Create a global variable of type ofstream for the output file*/ofstream outfile; /** This function asks the user for the number of employees in the company. This value should be returned as an int. The function accepts no arguments (No parameter/input).*/int NumOfEmployees();/** accepts an argument of type int for the number of employees in the company and returns the total of missed days as an int. This function should do the following:Asks the user to enter the following information for each employee:The employee number (ID) (Assume the employee number is 4 digits or fewer, but don't validate it).The number of days that employee missed during the past year.Writes each employee number (ID) and the number of days missed to the output file */int TotDaysAbsent(int numberOfEmployees);/* calculates the average number of days absent.The function takes two arguments:the number of…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





