Oct 12, 2015 at 2:39pm Oct 12, 2015 at 2:39pm UTC
How can I use cout inside a function to print out?
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
using namespace std;
void Print(){
cout << "Print this out " ;
}
int main() {
void Print();
}
Last edited on Oct 12, 2015 at 2:39pm Oct 12, 2015 at 2:39pm UTC
Oct 12, 2015 at 2:41pm Oct 12, 2015 at 2:41pm UTC
On line 10, you accidentally declare the function when you actually meant to call the function. Remove the word void
from line 10.
Oct 12, 2015 at 3:00pm Oct 12, 2015 at 3:00pm UTC
Make a function take 2 arguments and call it;
error: expected primary-expression before 'double' MaxorMin(int n, double x);
#include <iostream>
using namespace std;
void MaxorMin(int n, double x){
cout << "Type two numbers: ";
cin >> n >> x;
}
int main() {
MaxorMin(int n, double x);
}
Last edited on Oct 12, 2015 at 3:03pm Oct 12, 2015 at 3:03pm UTC