Monday, May 24, 2010

Error C4430: missing type specifier - int assumed. Note: C++ does not support default-int?

#include "stdafx.h"


#include %26lt;iostream%26gt;


using namespace std;





main()


{


int h;





cout %26lt;%26lt; "Enter an age and press ENTER: \n" %26lt;%26lt; h;


cin %26gt;%26gt; h;





if (h %26lt;= 0 %26amp;%26amp; h %26gt;= 12)


cout %26lt;%26lt; "The subject is a child.\n" %26lt;%26lt; h;





else if (h %26lt;= 13 %26amp;%26amp; h %26gt;= 19)


cout %26lt;%26lt; "The subject is a teenager.\n" %26lt;%26lt; h;





else if (h %26lt;= 20 %26amp;%26amp; h %26gt;= 60)


cout %26lt;%26lt; "The subject is an adult.\n" %26lt;%26lt; h;





else if (h %26lt;= 61 %26amp;%26amp; h %26gt;= 100)


cout %26lt;%26lt; "The subject is an adult.\n" %26lt;%26lt; h;





else


cout %26lt;%26lt; "The subject is dead.\n" %26lt;%26lt; h;





return 0;


}





can someone help me so the error goes away?

Error C4430: missing type specifier - int assumed. Note: C++ does not support default-int?
main()


...should be...


int main(void)





...aside from that, you should probably work on understanding how "else if" works.


No comments:

Post a Comment