1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ad libitum [116K]
3 years ago
6

Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata to writ

e this information separated by a space into a file called outdata. Assume that this is the extent of the output that this program will do. Declare any variables that you need.
Computers and Technology
1 answer:
Stells [14]3 years ago
8 0

Answer:

/*

* Program to write data to text file.

*/

#include<iostream>

#include<fstream>

#include<string.h>

using  namespace std;

int main()

{

//Variable to name and age of a person.

string name;

int age;

cout<<"Enter your name"<<endl;

cin>>name;

cout<<"Enter your age"<<endl;

cin>>age;

     //Creating object of ofstream.

   ofstream file;

   file.open ("outdata.txt");

   //Writing data to file named outdata.txt

   file<<name<<" "<<age;

   file.close();

 

}

Output:

Enter your name

John

Enter your age

25

Content of Output.txt:

John 25

Explanation:

To write data to a file  ofstream object is used. An ofstream object file is created first and then using this object a file named "outdata.txt" is created.

Finally using shift operator (<<), by means  of operator overloading, name and age of  person is transferred to file outdata.txt.

You might be interested in
A Game Object must have a Transform<br><br> True<br><br> False
vovikov84 [41]

Answer:

Yes

Explanation:because,have to update there apps or games and change there characters

3 0
3 years ago
The homepage is the page your browser displays when you first start the program
soldi70 [24.7K]
Home page usually refers to the page that initially displays if you type in http://www.example.com/  It's usally named index.html, index.shtml or the like.
3 0
3 years ago
In Microsoft Word, spelling errors are identified by a _____.
kvasek [131]
Red underline. Hope this helps.
5 0
2 years ago
Read 2 more answers
The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09
sammy [17]

In python:

age = float(input("How old are you? "))

weight = float(input("How much do you weigh? "))

heart_rate = float(input("What's your heart rate? "))

time = float(input("What's the time? "))

print("The calories burned for men is {}, and the calories burned for women is {}.".format(

   ((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * (time / 4.184),

   ((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022) * (time / 4.184)))

This is the program.

When you enter 49 155 148 60, the output is:

The calories burned for men is 489.77724665391963, and the calories burned for women is 580.939531548757.

Round to whatever you desire.

6 0
3 years ago
Which part of project management involves determining the required materials?
Katyanochek1 [597]
Resources I think because what u have all depends on resources
5 0
3 years ago
Read 2 more answers
Other questions:
  • Using the _______ list, you can select the number of photos that will appear on each slide.
    14·1 answer
  • What type of topology gives you a direct connection between two routers so that there is one communication path?
    14·1 answer
  • Suppose that Alice wants to send Bob a 50 kilobyte message over a 1 Gbps link. The total time required to transmit the message (
    5·1 answer
  • Help!!!! ASAP TIMED TEST 50 points!!!!
    7·1 answer
  • In order to plan George's birthday, his father gave him a list of people who attended his birthday for the last five years. What
    5·1 answer
  • Based on a Supreme Court ruling, an Internet-based merchant needs to charge sales tax only when _____.
    9·1 answer
  • Differentiate Between register and Memory location (
    13·1 answer
  • Create a Python program that: Allows the user to enter a person's first name and last name. The user should be able to enter as
    12·1 answer
  • What makes the huns a formidable force for the roman empire?
    5·1 answer
  • Which of the following is not a data visualization technique?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!