Write a C++ program to add two integers. Make a function add() to add integers and display sum in main() function.

Answers

Answer 1

Answer:

In C++:

#include <iostream>

using namespace std;

int add(int a, int b){

   int c = a + b;

   return c;

}

int main(){

   int a, b;

   cout<<"Enter two numbers: ";

   cin>>a;

   cin>>b;

   cout<<add(a,b);

   return 0;

}

Explanation:

The add() function begins here

int add(int a, int b){

This adds the two integers

   int c = a + b;

This returns the sum of the two integers

   return c;

}

The main begins here

int main(){

This declares two numbers

   int a, b;

This prompts user for two numbers

   cout<<"Enter two numbers: ";

The next two lines gets the two numbers

   cin>>a;

   cin>>b;

This gets the sum of the two numbers from the add() function. The sum is also printed

   cout<<add(a,b);

   return 0;

}


Related Questions

Imagine you are playing a video game like Super Mario or Sonic and you lose your last life. What are THREE distinct things that will happen once your lives become 0? Give three examples. Then put on your programmer's hat. Describe your examples using pseudocode; in other words, you don't have to use the exact language Scratch blocks would, as long as you write out each step in such a way that it's clear what the code would do.

Answers

Answer:

Three distinct things that would happen are

1) There would be a death animation played

2) GAME OVER text would appear

3) The game would most likely start over at the first level

Explanation:

The pseudocode:

1) Play death animation and music

2)Stop animation and music

3) Display Game over text

4) Remove game over text

5) Reset level

6) Open on beginning screen/level

* EMAIL*

What do you type in the “recipients” box

(A) The title of your email/summary of what you need

(B) The persons name you are sending an email to

(C) The question you are asking

Answers

Answer:

The correct answer is: (B) The persons name you are sending an email to.

Explanation:

"Recipients" are the people receiving the email whether it be one or multiple people. Those are the people that will be getting your email on whatever your sending your email about. Hope this helps you! :D

is a keyboard a software?

Answers

Answer:

Yes

Explanation:

Because it's apart of software hope this helps

The hardware is all the tangible computer equipment, such as the keyboard and mouse. The software is what makes the hardware work or lets you get things done, such as writing documents with Microsoft Word or playing a Solitaire game.

Is a keyboard a software or hardware?
Computer hardware includes the physical parts of a computer, such as the case, central processing unit (CPU), monitor, mouse, keyboard, computer data storage, graphics card, sound card, speakers and motherboard. By contrast, the software is the set of instructions that can be stored and run by hardware.


Hope it helps, have a great day!❤️✨

1) Given what you have learned about computers and information technology thus
far, what IT career interests you the most? Use the job descriptions and titles in the
"Computer and Information Technology" section of the Occupational Outlook
Handbook or the IT career cluster for your answer. (2 points)

Answers

B r u h that is mostly based on your opinion

What is the purpose of HTML?
A. to store data
B. to structure a document
C. to style a document
D. to add functionality

plz it a test

Answers

You can style and structure with it so it’s either one of those

PLZ HELP I NEED HELP 3RD GRADE MATH​

Answers

12/6 would be equal to 2
The answer would be ~12/6~ because 6*2=12 or 12 divided by 6=2

Hope this helps

Have a great day/night

The AND operator is a disjunction and the OR operator is a conjunction.

True
or
False

Answers

Answer:

True but it might be false but i think is true

whats wrong with my ps4 i cleaned it and it's still overheating and i have 3 fans for it

Answers

Answer: If your PS4 is overheating, It must be because of some dust you couldn't reach and piled up.

Explanation: What you need to do is take a can of compressed air and gently navigate it through the openings to the fan on your PS4. Go through and clean out the USB ports.

Which are two fundamental building blocks for creating websites?
OOOO
HTML
XML
CSS
DOCX
AAC

Answers

Hey the main coding languages for building websites are html. html is for the formatting . when CSS the other one is used for the style. we use CSS for style sheets and much more.  

if you think about it like a house html is the foundations and the walls and css is the paint.

Hope this helps.

Sean works with large multimedia files. He needs to send a very large file to a client for comments. What utility should he use?


Reducer

File Compression

Cleaner

File Wiping

Answers

File wiping i believe

This logo bby im sorry huhu​

Answers

Answer:

I believe this was for someone else online, Unfortunately that's a little weird to be dating here ya know, Never know if there is someone really old or young you could be dating.

One benefit proprietary licensed software is that it

Answers

Answer:C

Explanation:

Here is the answer to Edhesive 7.5 code practice


def GPAcalc(grade, weight):


grades = {"A": 4, "B": 3, "C": 2, "D": 1, "F": 0}


if weight == 0:


return grades[grade]


else:


return grades[grade] + 1


def Main(Random):

Print ("hi")


classes = int(input("How many Classes are you taking? "))


total = 0


for x in range(classes):


letter = input("Enter your Letter Grade: ")


user_weight = int(input("Is it weighted? (1 = yes 0 = no) "))


grade = GPAcalc(letter, user_weight)


total += grade


print("Your GPA score is: ", grade)


print("Your weighted GPA is a",(total/classes))

Answers

oh my god i could never do coding

PLEASE HELP ME!!!!!
In Python, an array is called a ______________.

Answers

Answer:

List

Explanation:

In python programming language, an array is also referred to as a sequence.

What are programming languages?

Programming languages are digital languages that help to create software and programs over computer and computers networks. Python is one such coding language, and is widely used globally.

In python, the arrays are representatives of a sequence, which may describe any data elements and are put into such sequence with proper index in a chronological order.

Hence, in a programming language like python, an array represents a sequence.

Learn more about programming languages here:

https://brainly.com/question/14379391

#SPJ2

A “drone” is:

A. A helicopter with four propellers.

B. Any vehicle used on a seek-and-destroy mission.

C. Any experimental test vehicle.

D. An unmanned aircraft.

Answers

D an unmanned aircraft because it is controlled remotely.

Which of the following is true of binary files?

Answers

Try using socrative to answer your question it’s really good

The statement which is true about binary files is:

A. They are associated with particular software programs

According to the given question, we are asked to select the statement from a list of answer choices which shows a correct statement about a binary file and its functions and characteristics.

As a result of this, we can recall that a binary file is one which has its files decoded by a program which has a good idea of how the formatting was done and certain information can be found.

With this in mind, the statement which is accurate about a binary file is that they are associated with particular software programs.

Therefore, the correct answer is option A.

Read more here:

https://brainly.com/question/23117620

You get an email from your project manager asking you to review the month's sales data. This is an
example of:
A globalization.
B delegation
C amplification
D disinformation

Answers

Answer:

delegation

Explanation:

Which of these is not a common type of programming design?
~object-oriented design
~structured programming design
~graphic design
~top-down programming design

Answers

Answer:

structured programming design.

Explanation:

Answer:

I can confirm its structured programming design

Explanation:

Do you think the constant use of the Internet for almost all information seeking is a good or bad thing? Explain.

Answers

good because you can get in touch with people . bad because wasting times and making lazy

How do you write a multiplication formula in excel with an absolute refrence?

Answers

To multiply all the numbers in column A by cell C2, add $ symbols to the cell reference like this: $C$2, which you can see in the example below. Using $ symbols tells Excel that the reference to C2 is “absolute,” so when you copy the formula to another cell, the reference will always be to cell C2.

What is the correct syntax to output the type of a variable or object in Python?

Answers

Answer:

If a single argument (object) is passed to type() built-in, it returns type of the given object. If three arguments (name, bases and dict) are passed, it returns a new type object. If you need to check type of an object, it is recommended to use Python isinstance() function instead.

The correct syntax to find a variable type in python is type().

The type () function is used to return the data type or the type of variable. Inside the bracket you would have to input an object. The object could be a list, a string, a tuple, or an integer.

For example:

Lets say age = 50

Now we are to find out if the variable age is an, integer, a list, a tuple or a string. So we put the  variable age into the syntax.

type(age)

The output that would be returned is int. This tells us that the variable age is an integer. Because 50 is an integer.

read more at https://brainly.com/question/1748722?referrer=searchResults

The process of acquiring existing information or developing new information.

Answers

Answer:

Various definitions of the SDLC methodology exist, but most contain the following phases.

Preliminary Analysis. In this phase, a review is done of the request. ...

System Analysis. ...

System Design. ...

Programming. ...

Testing. ...

Implementation. ...

Maintenance.

Explanation:

There are four methods of acquiring data: collecting new data; converting/transforming legacy data; sharing/exchanging data; and purchasing data. This includes automated collection (e.g., of sensor-derived data), the manual recording of empirical observations, and obtaining existing data from other sources.

Select all the steps needed to create a maintenance schedule. Identify individuals to perform the maintenance. Document or log maintenance that has been performed. Take an inventory of the equipment. Obtain test equipment if necessary. Define maintenance tasks. Review the manufacturers' manuals. Establish frequency of tasks. Run the defragmentation utility. Develop a reminder system.

Answers

Answer:

Maintenance planning and scheduling, arguably the most neglected functions of modern asset management, are at the heart of an effective maintenance management system. Through the use of work orders and a CMMS, maintenance planning covers the daily or weekly planning, scheduling and control activities to ensure that scheduled work is undertaken, and that available resources are being used optimally. Yet many organizations still struggle to make their maintenance planning and scheduling as effective as it should be.

Maintenance planning

Without planning and scheduling, the wrench-on time for a company is on average only 35%. That means that for every technician working an 8-hour day, only 2.8 hours of that day is spent working on assets. Implementing proper maintenance planning and scheduling, however, can increase the wrench time from 35% to 65%. At this level of efficiency, a technician working an 8-hour day will complete 5.2 hours of actual work. With 65% of the engineer’s time being used efficiently, only 35% of their time is wasted. This improvement would enable an organization to move away from a reactive (firefighting) state of maintenance, and improve overall workforce efficiency.

Explanation:

1. Identify the problem

The need for maintenance can be triggered by a failure, a noisy bearing or an oil leak. Once identified, the problem must be reported to the maintenance department. This is normally done through a work request so that planning and scheduling can take place.

2. Plan the maintenance task

‘Planning’ involves deciding on what exactly needs to be done, determining priority, and defining the sequence of activities and skills required. Ensure that all the resources, material, labor, contract services, specialist equipment, tools and information are available. There may even be a need for outside contractors, items to be purchased or work permits to be obtained, all of which must be arranged in advance.

A maintenance planning function is a critical tool for reducing downtime and maximising the value of preventive maintenance. The maintenance planner must therefore have the technical skills and equipment knowledge to do this planning.

3. Schedule the work

‘Scheduling’ involves deciding when to do the work. This will depend on the priority level of the task, and the availability of both the resources and the equipment to be repaired. Many organizations schedule maintenance for a specific period during the working week or month. Weekend maintenance is never desirable because, in many cases, suppliers are not available and personnel are expensive.

The legal requirements with regard to statutory inspections are generally quite rigid, so try and devise a 52-week maintenance plan at the beginning of each year. Review this plan periodically to improve the accuracy and quality of the information. Communicate the preventive and corrective maintenance requirements to production so that they fully understand the need for the maintenance window.

4. Allocate the task to specific people

Although this will depend on organizational arrangements, consider the following:

Allocate your maintenance personnel to specific areas or pieces of equipment

Ensure the allocated person has the skills to perform the task

Be very clear about the type of work that will be allocated to outside contractors

Where necessary, undertake hazard analyses to identify risks and formulate action plans to control access to high-risk areas; your plans should include hot work permits, confined space permits and lockout procedures.

5. Ensure the work is executed properly

It is usually the responsibility of the maintenance supervisor to confirm that the maintenance work meets the required quality standards, usually through selected planned job observations. The planner (or, in some instances, a maintenance scheduler) should monitor outstanding schedules or work requests to ensure that the planned work was actually done.

6. Analyze the problem and decide how to prevent it from happening again

Analyze the root cause of major failures and take corrective action to prevent recurrence. Corrective action could include training, a change to the preventive maintenance programme or equipment redesign. Breakdown or failure of the management process is often overlooked in a major failure. In those cases, corrective action may be a systems upgrade.

When all six of these foundational steps are implemented and combined correctly, maintenance planning can attain much greater levels of efficiency. This leads to important asset-related data and information being shared across the plant, and even across multiple plants. It’s not an overnight process though, so don’t give up if you think it might take too long. The benefits are well worth it.

Identify and eliminate problems quickly and effectively with How-to Guide: How to use a problem-solving A3 Report, an essential guide to compiling an A3 report

Multiple Select Which conditions make using an array a better choice than a list? Select 3 options. when your list would contain a mixture of numbers and string values when you have a very large quantities of numeric data values when all your data are string when you will do a great deal of arithmetic calculations when efficiency is of great importance

Answers

When you have a very large quantities of numeric data values

When you will do a great deal of arithmetic calculations

When efficiency is of great importance

The conditions that make using an array a better choice than a list are:

When you have very large quantities of numeric data valuesWhen you will do a lot of arithmetic calculationsWhen efficiency is of great importance

What are arrays?

An array is a set of items, images, or numbers arranged in rows and columns. Any set of rows or columns is referred to as an array. Examples of arrays include rows of seats for a recital, rows of cards laid out for the game of Memory, and rows of numbers in an Excel spreadsheet.

It is important to think of an array as a collection of variables of the same type even though it is used to store a collection of data. An array is a group of identically data-typed elements kept in consecutive memory regions.

Therefore, the correct options are B, when you have very large quantities of numeric data values, D, when you will do a lot of arithmetic calculations, and E. When efficiency is of great importance.

To learn more about arrays, refer to the link:

https://brainly.com/question/13107940

#SPJ5

Choose the best answer from the drop-down menu. A ______ allows multiple connections to a single signal. Without a ______, connecting to the Internet would not be possible. A ______ connects 1 or more networks and handles network traffic.

Answers

Answer:

Router

Explanation:

A router facilitates the communication of multiple devices wirelessly on a modem.

Answer:

A

✔ hub

allows multiple connections to a single signal.

Without a

✔ modem

, connecting to the Internet would not be possible.

A

✔ router

connects one or more networks and handles network traffic.

Explanation: This is the correct answer on Edge 2021, hope this helps^-^.


Which of the following is document content that displays at the top of every page?
Choose the answer.

style set

footer

header

title

Answers

Answer: Header/Title

Explanation:

3.
What is the meaning of *.VBP.

Answers

Answer:

The meaning of VBP is Visual Basic Project

Answer:

visual basic projects thankyouu HAHAHAHA

because cute ako

WHAT ARE THE RISK OF DUST​

Answers

Answer:

over heating

Explanation:

in computers dust acts as a blanket which traps heat, excessive heat causes components to burn up and short out

Imagine you are part of a school newspaper or school yearbook club. What application software would you need in order to produce your work?

Answers

Answer:

MS-Word

Explanation:

MS-Word is the application software that is used for document creation or for word processing. It is the widely used software for content writing purposes and processing of words. It is available by Microsoft.

MS- Word is very useful when writing any paragraph or any article for a book or for any newspaper. We can modify or edit our content in the application software. It is basically a word processor that was developed by Microsoft company in the year 1983.

In the context, MS-Word is the best application software that is used to produced the work for the school newspaper or for the school yearbook club.

can someone please help me answer this I can’t fail. tysm :)

Answers

Answer:

option d because of you. blaa

Explanation:

whu

Other Questions
A garden is going to be built in the city park in the shape of a parallelogram with a rectangular walkway through it. The garden region is shown below. Find the area of the garden region by finding the areas of the individual shapes shown in the figure. 78 ft 72 ft 30 ft 20 ft Answer: 8(4p+5)=8(5p-4) whats the answer Lynn is making a snack. The recipes call for 38 cup of water for oats and 14 cup of water for dried fruit. She only has 1 cup of water. Does she have enough to make her snack? Explain. No. Both recipes call for more than 1 cup, so the recipes will use more than 2 cups altogether. No. Both recipes call for more than half a cup, so the recipes will use more than 1 cup altogether. Yes. Both recipes call for exactly 1 cup, so the recipes will use exactly 1 cup altogether. Yes. Both recipes call for less than half a cup, so the recipes will use less than 1 cup together (b) The efficiency of the pump which operates the fountain is 70%.Calculate the power supplied to the pump. What cellular processes (2) are "hijacked" by the virus? what was the importance of the arcticles of confederation 1. Use the Pythagorean Theorem to find then find the perimeter and area of eachfigure (Round answers to the nearest tenthl. Be sure to put your unit of measure in thesecond blank7 cm10 cmx =perimeter =area = How to change this sentence into reported speech?You didn't need the new one.The old one worked perfectly well.You=DavidThe speaker =KateKate said that David ................................................................ In the interview, the star said that for leisure he enjoys outdoor activities, including hiking, biking, and surfing. find the value of the ratio (red to blue) of the areas of the similar figures. Write the ratio as a fraction in simplest form. Elsa, Ryan, and Bill have a total of $135 in their wallets. Ryan has 4 times what Bill has. Elsa has $9 more than Bill. How much does each have? Any remains, trace, or imprint of a plant or animal that has been preserved from some past geologic orprehistoric time is a(n) What do the goblet cells do in the respiratory system? 1) how can you make a solution more concentrated find the slope of the line To hold this federal office, you must be at least 30 years old, a U.S. citizen for 9 years, and live in the state you wish to represent. A: The House of Representatives B:The Senate C:The Supreme Court D: The Vice-President Please help! Ill mark you as brainliest if correct Mrs. Smith took her bird to the vet. Tweety weighed 1 and 3/10 pounds. The vet said that Tweety weighed 4/10pound more last year. How much did Tweety weigh last year? 1. Think of a time in your life when someone you know was having difficulty. Using that example, choose the statement from the list below that seems most true. Then, for the statement you choose, write which perspective or branch from psychology (humanistic, positive, biopsychology, cognitive-behavioral, developmental, or social psychology) is most related. Then write a one-sentence statement that describes this perspective. (5 points) What is the BEST reason to evaluate the decisions you make?1. to avoid making the same bad decision again2. to avoid making poor decisions in the future3. to minimize any harm your decision may cause others4. to keep yourself humblePlease answer ASAP! Thanks!