Need a little help
Been watching thenewboston's youtube tutorials, and memorising all of the tutorials.. etc
I got up to the "Dating young girls" episode in which he creates a function that calculates the minimum age of a girl that a person of your age can date...
the rule is half your age and add seven.
anyway, heres what I have done:
When I try to compile+run this, it gives me an error for the "cout << myfun(age)" statement in the main function. the error is "no match for operator<< in std::cout << myfun(age)". As far as I can see, I have done everything correctly, but I must be missing something. Can anyone help me out?
I got up to the "Dating young girls" episode in which he creates a function that calculates the minimum age of a girl that a person of your age can date...
the rule is half your age and add seven.
anyway, heres what I have done:
Code:
#include <iostream>
#include <cmath>
#include <cstdlib>
void myfun(int);
int main(){
using namespace std;
int age;
cout << "Enter your age: \n";
cin >> age;
cout << myfun(age);
cin.get();
return 0;
}
void myfun(int myage){
using namespace std;
int girlsage = myage/2+7;
cout << "You can date girls that are " << girlsage << " and above.\n";
}