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

Write a function that removes all even numbers from an array. The function should take the...
Write a function that removes all even numbers from an array. The function should take the array, length of the array, and a pointer for number of odd numbers found as arguments and return a pointer to the new array. If there are no odd numbers found in the array, your code should print "No odds found." and return NULL. Use the function header: int *removeEvens(int *a, int length, int *oddsFound); Example: Input array a[ ] = {3, 4, 5,...
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 Program for Examination depart of your college. Program should take these inputs Name, Roll...
Write a Program for Examination depart of your college. Program should take these inputs Name, Roll No, Faculty, and All 4 Subjects Marks. After that Clear the Console Screen & Print an eye-catching Mark sheet. This is showing Name, Roll No, Faculty, All 4 Subjects Marks, Total Marks, Percentage, Grade and Remarks. Follow below criteria for Grade & Remarks Percentage Grade Remarks >= 87 A Excellent 78 - 86 B+ Good 72 – 77 B Good 66 – 71 C+...
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 c++ program that inputs a time from the console. The time should be in...
Write a c++ program that inputs a time from the console. The time should be in the format “HH:MM AM” or “HH:MM PM”. Hours may be one or two digits. Your program should then convert the time into a four-digit military time based on a 24-hour clock. Code: #include <iostream> #include <iomanip> #include <string> using namespace std; int main() { string input; cout << "Enter (HH:MM XX) format time: "; getline(cin, input); int h, m; bool am; int len =...
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 a function printTwoLargest() that inputs an arbitrary number of positive numbers from the user. The...
Write a function printTwoLargest() that inputs an arbitrary number of positive numbers from the user. The input of numbers stops when the first negative or zero value is entered by the user. The function then prints the two largest values entered by the user. If no positive numbers are entered a message to that effect is printed instead of printing any numbers. If only one number is inputted, only the largest is printed out (see 2nd example below). Sample output:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT