Question

In: Computer Science

Write a function of interest to you. It should that take at least 3 inputs from...

Write a function of interest to you. It should that take at least 3 inputs from different types and return at least three different values.

Call your function from the main.

Print the resultant outputs in the main (not in the function).

Solutions

Expert Solution

If you have any doubts, please give me comment...

#include<iostream>

#include<string>

using namespace std;

void readInputs(int &inp1, double &inp2, string &inp3);

int main(){

    int inp1;

    double inp2;

    string inp3;

    readInputs(inp1, inp2, inp3);

    cout<<"\nEntered data:"<<endl;

    cout<<"Input 1: "<<inp1<<endl;

    cout<<"Input 2: "<<inp2<<endl;

    cout<<"Input 3: "<<inp3<<endl;

    return 0;

}

void readInputs(int &inp1, double &inp2, string &inp3){

    cout<<"Enter any integer: ";

    cin>>inp1;

    cout<<"Enter any decimal value: ";

    cin>>inp2;

    cout<<"Enter a string: ";

    cin>>inp3;

}


Related Solutions

This is python: #Write a function called count_positive_evens. This function #should take as input a list...
This is python: #Write a function called count_positive_evens. This function #should take as input a list of integers, and return as #output a single integer. The number the function returns #should be the count of numbers from the list that were both #positive and even. # #For example: # # count_positive_evens([5, 7, 9, 8, -1, -2, -3]) -> 1 # count_positive_evens([2, 4, 6, 8, 10, 12, 15]) -> 6 # count_positive_evens([-2, -4, -6, -8, -10, 1]) -> 0 # #0...
Write a Matlab function called: lin_interp. The function should have three inputs: the two original data...
Write a Matlab function called: lin_interp. The function should have three inputs: the two original data arrays (call them x and f), and the array you would like to interpolate to (call it xstar). The function should have one output: the interpolated array ( call it fstar). The function should be able to interpolate x and f onto xstar using linear interpolation and give the result as fstar. The function may not use any intrinsic functions except length.
Write a Java program to implement a Single Linked List that will take inputs from a...
Write a Java program to implement a Single Linked List that will take inputs from a user as Student Names. First, add Brian and Larry to the newly created linked list and print the output Add "Kathy" to index 1 of the linked list and print output Now add "Chris" to the start of the list and "Briana" to the end of the list using built-in Java functions. Print the output of the linked list.
Write a function that inputs a list of numbers and a percentile value from 0 to...
Write a function that inputs a list of numbers and a percentile value from 0 to 1 and have the function return the element that is at that percentile (or greater than). You can use this website for the steps https://www.indeed.com/career-advice/career-development/how-to-calculate-percentile check out the step for “Follow these steps to calculate the kth percentile” def percentileReturn(list1,percentile):#function which returns the list of elements which are greater than or equal to the percentile list2=[i for i in list1 if i>=percentile] #creating list2...
Write a function in R named counts. This function should take as parameters a numeric vector...
Write a function in R named counts. This function should take as parameters a numeric vector x and also a number indicating a number of bins n. The function will consider the range [min(x),max(x)], and then consider a parti- tion of this interval into n non-overlapping equally sized half open intervals: I1 = [min(x),b1),I2 = [b1,b − 2),...,In = (bn−1,max(x)]. Note that since the intervals are equally sized, the value of bi is constrained. The function will then return a...
write a matlab function for frequency analysis using DFT. the function should take as input a...
write a matlab function for frequency analysis using DFT. the function should take as input a signal, and as output the number of sinusoids and their frequencies.
Write an overloaded function of function area with 3 (float) parameters. This function should calculate and...
Write an overloaded function of function area with 3 (float) parameters. This function should calculate and print out the product of the 3 parameters.
Write in java please Instructions Your goal is to take N integer inputs from the user...
Write in java please Instructions Your goal is to take N integer inputs from the user -- N's value will be given by the user as well. You can assume the user provides a valid value for N, i.e., >0. Store the input integers in an array of size N in the order they are provided. These tasks should be done in the main() method. Create a new method called checkArray() that will take the previously created array as input...
using python 1. #Write a function called multiply_file_by_index. This function #should take two parameters, both strings....
using python 1. #Write a function called multiply_file_by_index. This function #should take two parameters, both strings. The first string is #the filename of a file to which to write (output_file), and #the second string is the filename of a file from which to read #(input_file). # #In the input file, there will be an integer on every line. #To the output file, you should write the integer from the #original file multiplied by the line number on which it #appeared....
In this lab we will write 3 functions: GenData: This function will take an integer parameter...
In this lab we will write 3 functions: GenData: This function will take an integer parameter and return a vector with that many random integers generated in the range of 0 and 100 (rand()%101). Seed the random number generator with 22. Mean(): This function will take a vector and return the mean. Variance(): This function will take a vector and return the population variance, as: [Sum for values[( x_i - Mean )^2]] / (number of items) In Main: Use GenData...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT