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
spin [16.1K]
4 years ago
8

Write a program that read first a user's given name followed by the user's age from standard input. Then use an ofstream object

named outdata (which you must declare) to write 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:
mr_godi [17]4 years ago
3 0

Answer:

Following are the program to this question:

#include <iostream> //defining header file

#include <fstream>//defining header file

using namespace std;

int main()//defining main method

{   string name; //defining string variable

   int age; //defining integer variable

   cout << "Enter your name: "; //print message

   getline(cin, name); //input value using getline method

   cout << "Enter your age: "; //print message

   cin >> age; //input value

   ofstream outdata("outdata"); //using ofstream method

   outdata << name << " " << age << endl; //print value

   outdata.close(); //closing outdata.

   return 0;

}

Output:

Enter your name: dev

Enter your age: 22

please find the attachment.

Explanation:

Description of the above can be described as follows:

  • In the main method, two variable "name and age" is declared, in which name is string variable, and age is an integer variable, in both variable, we take user input, but in the name variable, the inline method is used, that take input from the user end.
  • In the next step, ofstream method is used, which creates an object "outdata", which prints user input value in the "outdata" file separated by a single space.

You might be interested in
What is the google search operator that limits results to a specific domain?
IrinaK [193]

Answer:

 Google search operator is also known as advanced operator which extend the various capabilities of the regular type of text searches. It basically contain various types of special characters and the commands.

Google search operator are very useful in the various technical and the content searches. This type of search operator also limits the result in the sites which are indexed with a specific domain and URL (User resource locator). The google search basically allow to use various symbols that are based on the operator.  

7 0
3 years ago
Create a set of functions that compute the mean, median, and mode of a set of
zepelin [54]

Refer to the attachment.

Language used=Python

5 0
3 years ago
Read 2 more answers
Which of the following tasks is an interactive media professional most likely to do? Check all of the boxes that apply. 1. decid
GREYUIT [131]

Answer:

decide how a website should look and  

test a software program to ensure that the visual elements are working

Explanation:

i just did it

8 0
3 years ago
Read the section, "Junior Year." Why would someone chose to complete an apprenticeship after high school? How many occupations c
Tamiku [17]

An apprenticeship prepares you for a career through a structured program of on-the-job learning with classroom instruction, while you work and earn a salary. The programs can last from one to six years and you can choose careers in areas such as telecommunications, health care, computing, business support and the arts. The most common apprenticeships are in construction and manufacturing. If you like to work with your hands and your mind, you might want to consider an apprenticeship after high school. More than 850 occupations can be learned on the job through an apprenticeship.

7 0
3 years ago
Read 2 more answers
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle w
Alecsey [184]

The time being referred to is C. cycle time. Cycle time refers to the amount of time from start to end of a process as agreed and defined by a service provider (in this case, the technician) and the customer. Cycle time can also be lengthened or shortened.

5 0
4 years ago
Read 2 more answers
Other questions:
  • A computer professional who has access to sensitive information shares this information with a third party. Which professional c
    9·2 answers
  • Invention I chose was radio.
    9·1 answer
  • Podcast ____ software uses rss to allow you to subscribe to your favorite podcasts from one central application.
    12·2 answers
  • Employees of Bodegas &amp; Bistros Inc. (2B) maintain a password-protected social media page to "vent about work." When 2B learn
    12·1 answer
  • Which kind of results will appear using the search query "Frosty the Snowman" in quotation marks?
    6·1 answer
  • Technician A says that a lead acid battery uses straight Hydrochloric acid for electrolyte. Technician B says that a lead acid b
    10·2 answers
  • If you have 128 oranges all the same size, color, and weight except one orange is heavier than the rest. Write down a C++ Code/A
    7·1 answer
  • Write a python program to print numbers from 100 to 50 using for loop.<br> I NEED THIS URGENT PLEASE
    9·1 answer
  • Can rank u r guys in rocket leagye
    13·1 answer
  • Firestick optimizing system storage and applications
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!