Assuming dataFile is an ofstream object associated with a disk file named payroll.dat, which of the following statements would write the value of the salary variable to the file
A) cout < B) ofstream C) dataFile << salary;
D) payroll.dat <

Answers

Answer 1

Answer:

dataFile << salary;

Explanation:

To write salary to a file (payroll.dat) using ofstream, you make use of the following instruction:

ofstream dataFile;

myfile.open ("payroll.dat");

myfile <<salary;

myfile.close();

This line creates an instance of ofstream

ofstream dataFile;

This line opens the file payroll.dat

myfile.open ("payroll.dat");

This is where the exact instruction in the question is done. This writes the value of salary to payroll.dat

myfile <<salary;

This closes the opened file

myfile.close();


Related Questions

Write a program that reads an integer between o and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all the digits is 14. Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digit. For instance, 932 % 10=2 and 932/10 =93. Here is a sample run:
Enter a number between 0 and 1000 : 999
The sum of digits is 27.

Answers

Answer:

Answered below

Explanation:

#Program is written in Python programming language

digit = 0

sum = 0

num = int(input("Enter a number between 0 and 1000: ")

#Check that number is within the valid range

if num > 0 and num <= 1000:

while num != 0:

#Isolate each digit

digit = num % 10

sum = sum + digit

#Remove isolated digit from number

num = num/10

else:

print("Number is not within valid range")

#print total sum of digits

print(sum)

Gamification and virtual reality is the future of education

Answers

Answer:

Education is expected to be the fourth largest sector for VR investment. VR in education is predicted to be a $200 million industry by 2020, and a $700 million industry by 2025. 97% of students would like to study a VR course.

Explanation:

What email program would you suggest and why?

Answers

Answer:

An email program

Explanation:

And why?

Answer:

I would suggest g m a i l.

Explanation:

I use G m a i l all the time and I think it is easy to use! A lot of people think it is great too! :)

Identify the correct characteristics of Python lists. Check all that apply. Python lists are enclosed in curly braces { }. Python lists contain items separated by commas. Python lists are versatile Python data types. Python lists may use single quotes, double quotes, or no quotes.

Answers

Answer:

Python lists contain items separated by commas.

Python lists are versatile Python data types.

Python lists may uses single quotes, double quotes, or no quotes.

Explanation:

Python Lists are enclosed in regular brackets [ ], not curly brackets { }, so this is not a correct characteristic.

Answer:

a c d

Explanation:

How to do brainliest

Answers

If the reply that someone put has a blue crown you click it and it will give them brainliest but it usually won’t work unless there are two answers
Other Questions
And this one please Why was Fort Sumters location important?A).It was near the capital of the Union.B).It blocked shipping lanes in the North.C).It served as the base of the Confederacy.D).It protected commercial areas in the South. Will mark brainliest!! Please do the two in green using cos!! Which sentence correctly uses the conditional mood?I would have told the truth if I'd known it.I would tell the truth if I will know it.I will tell the truth when I know it.I would tell the truth if I'd known it. I will give brainiest to whoever answers correctly !! 3 3/5 x (-8 1/3) = Please help and quick Explain why Louie was described as untamable 0.03y=-0.01x+0.12HALPGRAPH PLEASE 1V1 ME FOR A YOU TUBE VID NAME IS QT ZIHMIR YT Mr. Lincon buys juice and water for the school picnic.A pack of 8 juice boxes costs 5 dollars. A pack of 6 water bottles costs 3 dollars. Mr Lincoln spends 95 dollars for 170 juice boxes and bottles of water Canada shares a boarder with three large bodies of water. TrueFalse A. The actual building height will be 596 ft tall. You want your model to be 3 ft tall. What will the scale factor be? For this project, the constant of proportionality is ________. Each inch of the model will represent ________ft of the actual building.B. The actual building height will be 254 ft tall. You want your model to be 5 ft tall. What will the scale factor be? For this project, the constant of proportionality is ________. Each inch of the model will represent ________ft of the actual building.C. The actual building height will be 1087 ft tall. You want your model to be 6 ft tall. What will the scale factor be? For this project, the constant of proportionality is ________. Each inch of the model will represent ________ft of the actual building. what is the formula to calculate velocity? Work needs to be shown please someone help and dont answer for your benefit with no intention to help Q +2.02=9.2 q equals What is the value of x? pls answer if you can Solve the inequality 37v < -18 Four friends own a carwash, the first total profit in the first month was 438 and two months each other friends had made a profit of 184 they always divide the profits eat equally how much profit did the car wash making the second month? Write down all your mechanisms for handling tough situations. Evaluate the ones that are most helpful and the ones that are the most not helpful?