nothingasis
In Runtime
- Messages
- 198
- Location
- CA
So I'm being told in this problem to, pass two values to a type void function that displays the two values through the main() function.
#include <iostream>
void display(int);
int main ()
{
using namespace std;
cout << "Enter the number of hours: ";
int hours;
cin >> hours;
int minutes;
cout << "Enter the number of minutes: ";
cin >> minutes;
display(hours, minutes);
system ("pause");
return 0;
} // Closes off the function
void display(int hours, int minutes)
{
using namespace std;
cout <<"Time: " << hours << ":" <<minutes <<endl; display()
}
It gives me the error, "display function does not take 2 arguments.
I understand that, that is true but I'm not sure what other approach i can take with this. I'm still really new to this so, if possible I'd like to stick to the basics with no advance way of doing this that may make it a lot easier.
So, tell me programmers what am I doing wrong here and what should I do about it? Please and thank you!
#include <iostream>
void display(int);
int main ()
{
using namespace std;
cout << "Enter the number of hours: ";
int hours;
cin >> hours;
int minutes;
cout << "Enter the number of minutes: ";
cin >> minutes;
display(hours, minutes);
system ("pause");
return 0;
} // Closes off the function
void display(int hours, int minutes)
{
using namespace std;
cout <<"Time: " << hours << ":" <<minutes <<endl; display()
}
It gives me the error, "display function does not take 2 arguments.
I understand that, that is true but I'm not sure what other approach i can take with this. I'm still really new to this so, if possible I'd like to stick to the basics with no advance way of doing this that may make it a lot easier.
So, tell me programmers what am I doing wrong here and what should I do about it? Please and thank you!