C++ Keywords

This entry is part 21 of 61 in the series C++

Keywords are identifier that form the statements and syntax of a programming language.

As C++ is derived from C and it is a superset of C.

The keywords in C++ consists of the keywords in ANSI C and the keywords in C++ 11.

ANSI C and C++ Keywords

autobreakcasecharconst
continuedefaultdodoubleelse
enumexternfloatforgoto
ifinlineintlongregister
returnshortsignedsizeofstatic
structswitchtypedefunionunsigned
voidvolatilewhile

C++ 11 Additions

alignasalignofasmboolclass
catchchar16_tchar32_tconst_castconstexpr
decltypedeletedynamic_castexplicitexport
falsefriendmutablenamespacenew
noexceptnullptroperatorprivateprotected
publicstatic_assertstatic_casttemplatethis
thread_localthrowtruetrytypeid
typenameusingvirtualwchar-t

C++: The if-else statement

This entry is part 11 of 61 in the series C++

The if…else statement allows you to specify an action to perform when the condition is true and a different action to perform when the condition is false.

#include <iostream>
#include <string>
using namespace std;

void main()
{
	int grade = 70;

	if (grade >= 60)
		cout << "Passed";
	else
		cout << "Failed";

	cout << endl;
}

In the above code line 9 will evaluate to true and so the string Passed will be printed out.

ifelse