Concept explainers
What output will be sent to the stuff.dat when the following lines are executed (assuming the lines are embedded in a complete and correct
ofstream fout;
fout.open(“stuff.dat”) ;
fout << “*” << setw(5) << 123 << “*”
<< 123 << “*” <<endl;
fout.setf(ios::showpos);
fout << “*” << setw(5) << 123 << “*”
<< 123 <<“*”<<endl;
fout.unsetf(ios::showpos);
fout.setf(ios::left);
fout << “*” << setw(5) << 123 << “*”
<< setw(5) << 123 << “*” <<endl;
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Modern Database Management
Database Concepts (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
- Write a program that computes the tax and tip on a restaurant bill for a patron with a$44.50 meal charge. The tax should be 6.75 percent of the meal cost. The tip should be15 percent of the total after adding the tax. Display the meal cost, tax amount, tip amount,and total bill on the screen. Use the template, Program1-Template.cpp, to complete thisprogramming assignment. Download the attached file, Program1-template.cpp, from Blackboard and rename it asProgram1.cpp. Any line that starts with the characters "//" is a comment in C++ and thecompiler ignores it. Remove the angle brackets "<" and ">" in any line that starts with "//"and replace it with the appropriate information.arrow_forwardComplete the following incomplete program (begin by copy-pasting that into a new program file). The completed program will provide a user interface to draw as many circles as the user wants only by clicking in the window. After getting the number of circles (n) to draw as input from the user through the provided interface, the program should iterate n times. In each iteration it should wait for the user to click twice and draw a circle with center at the point where the user clicked first and with radius calculated as its distance from the second point where the user clicked. It should then fill the circle with a random color. Hints: Distance between two points with coordinates x1 & y1 and x2 & y2 and can be calculated as sqrt((x1-x2)2 + (y1-y2)2 ). To generate a random color, use randint(0,255) from the random libray to generate a random number between 0 and 255 (both inclusive). Use it three times to get the r, g and b values to generate a random color from graphics import…arrow_forwardWrite code to get the following output using c++ languange. Unsure how to write the code in order Hello my name is.arrow_forward
- Hello I need some help with this. I keep getting this one wrong. The language program is Python.arrow_forwardThe template code defines a Time struct. Given main() that reads two Times and computes the difference between the two, complete the following two functions: main() provides ReadTime() to read input from a user and use the input to create a new Time by calling Create Time(). PrintTime() is provided to output Time in 24 hour format (hh:mm:ss). Ex: If the input is: the output is: 22 23 24 1 #include 2 #include 3 30 31 1. Time* CreateTime(int hours, int minutes, int seconds) o Allocate and return a new Time according to the parameters 2. Time* TimeDifference (Time* end, Time* start) o Allocate a new time to store the computed time difference 02 55 10 04 15 50 4 typedef struct Time_struct { 5 int hours; int minutes; int seconds; Time; 25 26 } 27 32 33 34 • Compute the amount of time elapsed from start to end. Assume start is always before end. o Adjust for negative minutes and seconds. o Return the pointer to Time that contains the difference 6 7 8 9 10 // ALLocate and return a Time as…arrow_forwardon this photos, it is my source code program in Dev C ++. Just please make me a script of explanation on how this function and the code itself. thankyouarrow_forward
- Computer Science In a file named Exercise2.c write the function double sum(double (*f)(double), int start, int end); The call sum(g,i,j) should return g(i)+…+g(j). Add a main function to illustrate the use of your implementation of sum applied to sqrt from 1 to 10.arrow_forwardplz solve it by using easy language of c++?arrow_forwardUsing C++ Write a void function GetYear that prompts for and inputs the year the operator was born (type int) from standard input. The function returns the user’s birth year through the parameter list (use pass by reference) unless the user enters an invalid year, in which case a BadYear exception is thrown. To test for a bad year, think about the range of acceptable years. It must be 4 digits (i.e. 1982) and it cannot be greater than the current year (the user obviously cannot be born in a calander year that has yet to happen!arrow_forward
- What output would be produced in the previous exercise if the > sign werereplaced with < ?arrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forwardWrite a C Program that takes an input (2 text.txt) files, and counts the number of times the elements of File 1, appear in File 2, and print the result as shown. Please read the example below: Example: File A: BarcelonaDublinLas VegasLisbonLondonMadridNew YorkRioSan FransiscoShanghaiToronto File B: BarcalonaMadridMadridMadridMadridSan FransiscoTorontoVancouver Output after running the C Program using Binary Search Algorithm is: Barcelona is present 1 time/sDublin is present 0 time/sLas Vegas is present 0 time/sLisbon is present 0 time/sLondon is present 0 time/sMadrid is present 4 time/sNew York is present 0 time/sRio is present 0 time/sSan Fransisco is present 1 time/sShanghai is present 0 time/sToronto is present 1 time/sarrow_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