Learn C++ Basic: If statement


"IF" statement is expressed as:
if (condition)
{
   statement1;
}
else
{
   statement2
}

Meaning: if condition is satisfied, statement1 will be executed and statement2 will be passed. 
                if condition is NOT satisfied, statement2 will be executed and statement1 will be passed

Practice: make console program to see how it run


Step1: Making new project

Step2: Choose Console Application, type project name:

Step3: Input the code to main program

Step4: Build program, choose YES in next window



Step5: Input number 3 to see if program run or not. Also, input number 0 to test program


0 Comments: