Question on functions

For my class i have to write a program. It must have:

- function named check () with three arguments; 1st argument is an integer number, 2nd is a double precision number and last is a double precision number.

- they want it just display values of the data passed to the function when it is called.

If i can get some help with this question id very much appreciate it :)

This is what i have thus far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#include <iostream>
using namespace std;

void check (int number)

{
      
      cout << "Please type in a number: " << endl;
      
      cin >> number;
      
      cout << number;
    
    system ("pause");
    
 
}
Your kinda on the right track. Inside main() is where you gather your input for those three variables, then pass them to check() and cout them.

I don't wanna just give you the answer so...

with void check(int number) you accepted the first argument, and integer number. So to get the rest, just add more.

ex: check( int number, double number2, and so on).

where in check() you would cout number, number 2, etc...
your right just keep passing the rest of the numbers throught, then call your function in main(), but what do you mean as double precision, setting the variable as a double , or setting the precision of the double to 2 decimal places. I thing if your include #include <iomapi> or something like that you can use a function call setPrecison(), google it.
I thing if your include #include <iomapi> or something like that you can use a function call setPrecison(), google it.


"google it"? You do realize this is a C++ reference site, yah? ;P

There's a nice "Reference" link on the left side-bar which links you to details of standard lib functions

http://cplusplus.com/reference/iostream/manipulators/setprecision/
ha you caught me, but ya that link explains what im tryin to say
Topic archived. No new replies allowed.