ok here is my code now: Same error as above:
Code:
/*
Write a function called foo that asks the user for their age.
Pass the age value to a function called showAge that uses a select case structure to print out the following:
If the age is 0-12 print out "You are still a child. If the age is 13 - 19 print out "You are a teenager.
If the age is 20 - 40 print "You are an adult" anything else print "You are starting to become mature"
*/
#include <iostream>
using namespace std;
int foo (int x);
int showAge (int &x);
int main()
{
foo();
return 0;
}
int foo(int x)
{
cout << "Please Enter Your Age:" << endl;
cin >> x;
showAge();
return x;
}
int showAge (int &x)
{
if(x>0&&x<12) x=1;
if(x>=13&&x<19) x=2;
if(x>20) x=3;
switch ( x )
{
case 1:
cout << "You are still a child" << endl;
break;
case 2:
cout << "You are a teenager." << endl;
break;
case 3:
cout << "You are an adult" << endl;
break;
default:
cout << "ou are starting to become mature or too old" << endl;
return x;
}
Comment