c++ expected a declaration error?

the if statement is giving me this error

"expected a declaration - old style format list"

however I'm sure its not due to a semicolon or () 

any ideas whats wrong 

#include "headerfinal.h"

#include <iostream>

using namespace std;

int age = 5;

if (int age > 4 || age < 110) {

 cout << "How old are you?: " << endl;

 cin >> age;

}

else (age > 0) {

 return num;

}

string getFullName(string a, string b)

{

 string c = a + " " + b;

 return c;

}

void PrintHeader()

{

 cout << "Name: Lisa Baio" << endl;

}

1 Answer

Relevance
  • EddieJ
    Lv 7
    2 months ago

    else (age > 0) {

    could be

    else if (age > 0) {

    but is that in a function?  There's no function header shown.

    Overall it just doesn't make sense.

    • ...Show all comments
    • EddieJ
      Lv 7
      2 months agoReport

      if (age > 4 || age < 110) {
      This will always be true.  age will always either be greater than 4 or less than 110.

    • Login to reply the answers
Still have questions? Get your answers by asking now.