#include #include using namespace std; //A function to print a cool banner. //void functions do stuff, they don't return anything. void printBanner() { cout << "***************************" << endl; cout << "* Welcome to the class!!! *" << endl; cout << "***************************" << endl; cout << endl; cout << endl; } //Functions can take parameters as input void printPersonalBanner(string name) { cout << "******************************" << endl; cout << "* Hi " << name << "***********" << endl; cout << "* This is your personalized banner. *" << endl; cout << "* Wow, " << name << " is a really cool name *" << endl; } //Functions can take more than one input void birthdayGreeting(string name, int age) { cout << "Happy birthday " << name << "!" << endl; cout << "You are " << age << " years old!" << endl; if (age > 60) cout << "Ok boomer!" << endl; else if (age < 25) cout << "Ok Zoomer!" << endl; else cout << "Ok normal aged person." << endl; } //functions can return values. //This function computes the product of x and y //and returns that product double product(double x, double y) { return x * y; // double answer; // answer = x * y; // return answer; } //Challenge: return the value of n! int factorial(int n) { } int main() { printBanner(); printBanner(); printBanner(); //Now, let's make a cooler banner that says someone's name on it //Functions can take a parameter as input printPersonalBanner("Amanda"); printPersonalBanner("Johnson"); printPersonalBanner("Bruno"); //Let's make a birthday banner string someName; int someAge; cout << "Hey, what's your name and age? " << endl; cin >> someName; cin >> someAge; birthdayGreeting(someName, someAge); birthdayGreeting("Perseus", 17); birthdayGreeting("Gerarld", 70); //Function can have return values double a = 5.4; double b = 7.3; double answer; answer = product(a, b); cout << "the product of " << a << " and " << b << " is " << answer << endl; cout << "and product of 35 times 71 is " << product(35, 71) << endl; //Challenge: Let's solve the quiz cout << "Enter a number: " << endl; int n; cin >> n; cout << "Factorial of your number is: " << factorial(n) << endl; return 0; }