Question

Hello please help asap under 30 mins please. in C++ Programming

2.Write down a function that will input three integers to be used in the main application such that these integers and their average should be returned to the main. Write a set of statements that will call this function and displays the numbers and their average2. Write down a function that will input three integers to be used in the main application such that these integers and their

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program Code to Copy:

#include<iostream>

using namespace std;

float findAverage(int *a,int *b,int *c)

{

    float avg;

    cout<<"Enter first number:";

    cin>>*a;

    cout<<"Enter second number:";

    cin>>*b;

    cout<<"Enter third number:";

    cin>>*c;

    avg = (float)(*a + *b + *c)/3;

    return avg;

}

int main()

{

    int a,b,c;

    float average;

    average=findAverage(&a,&b,&c);

    cout<<"\nEntered numbers are\n";

    cout<<"First number: "<<a<<endl;

    cout<<"Second number: "<<b<<endl;

    cout<<"Third number: "<<c<<endl;

    cout<<"\nAverage of the numbers is "<<average;

    return 0;

}

Output Screenshot:

PS D:\CH> cd d:\CH\; if ($) { gut average.cpp -o average }; if ($?) { . \average } Enter first number:7 Enter second number

Add a comment
Know the answer?
Add Answer to:
Hello please help asap under 30 mins please. in C++ Programming 2.Write down a function that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • hello please i need help ASAP QUICKLY Write down a complete C++ program that will use...

    hello please i need help ASAP QUICKLY Write down a complete C++ program that will use the following functions related with a triangle; a) a function that will let the user to input the and to return the sizes of the three sides, let say a, b, c. b) a function that will calculate and return the area of the triangle; Area=(1/2)(a+b+c) c) a function that will print the sizes of the triangle and its area on the screen. Then...

  • Please write down the equation for calculating the probability & use c language for programming part....

    Please write down the equation for calculating the probability & use c language for programming part. Thank you! Prob. 5 (20pts) (Birthday attack) A birthday attack is a type of cryptographic attack that exploits the mathematics behind the birthday problem in probability theory. It can be used to find collisions in a cryptographic hash function. Suppose that we have a hash function which, when supplied with a random input, returns one of 256 equally likely values. The attack generates n...

  • Please use python 3 programming language Write a function that gets a string representing a file...

    Please use python 3 programming language Write a function that gets a string representing a file name and a list. The function writes the content of the list to the file. Each item in the list is written on one line. Name the function WriteList. If all goes well the function returns true, otherwise it returns false. Write another function, RandomRange that takes an integer then it returns a list of length n, where n is an integer passed as...

  • In C++ Please work on the following short programming assignments and upload your solutions on a...

    In C++ Please work on the following short programming assignments and upload your solutions on a single .txt file. 1. Write a function to take two integers and return the maximum number. Then, in the main function, ask the user to enter 2 numbers and output the maximum using the function. 2. Write a program to input 5 integers and store them in an array. Then, show the array in the output. 3. Write a program to input 5 numbers...

  • C and C++ Console Application for Student Data 1- Write a function named Average that a....

    C and C++ Console Application for Student Data 1- Write a function named Average that a. Receives two integer numbers as parameter and returns the average b. Is used in a main function. Main() stays in a loop and asks user to enter 2 numbers and then shows the average using the Average function above 2- Define a class named Student with following members: a. private data: 2 grades and a GPA (average). b. public constructor to initialize the members...

  • using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average...

    using c/c++ Q1 (15 Marks) Console Application for Student Data 1- Write a function named Average that Receives two integer numbers as parameter and returns the average Is used in a main function. Main() stays in a loop and asks user to enter 2 numbers and then shows the average using the Average function above Define a class named Student with following members: private data: 2 grades and a GPA (average). public constructor to initialize the members a public function...

  • In c++ programming, can you please edit this program to meet these requirements: The program that...

    In c++ programming, can you please edit this program to meet these requirements: The program that needs editing: #include <iostream> #include <fstream> #include <iomanip> using namespace std; int cal_avg(char* filenumbers, int n){ int a = 0; int number[100]; ifstream filein(filenumbers); if (!filein) { cout << "Please enter a a correct file to read in the numbers from"; }    while (!filein.eof()) { filein >> number[a]; a++; } int total = number[0]; for (a = 0; a < n; a++) {...

  • C++ programming question Topic: Class 'Date' Hello everybody, can some one help me... ... Write a...

    C++ programming question Topic: Class 'Date' Hello everybody, can some one help me... ... Write a class Date with the following properties: a) Data elements of the class are day, month, year. All three data elements are defined by the Type int. b) A set and a get element function are to be provided for each data element. In Within the framework of this task, it should be assumed that the values that are passed for day and year, are...

  • Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program...

    Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program that contains the following functions: 1. A function to read integer values into a one-dimensional array of size N. 2. A function to sort a one-dimensional array of size N of integers in descending order. 3. A function to find and output the average of the values in a one dimensional array of size N of integers. 4. A function to output a one-dimensional...

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT