If Statement In C++

C++ conditional statement allows us to create decisions in C.We know very well that no work is happening without any condition then how can I use this conditional term in programming languages.

There Are Many Way To Use Conditional Statement In C++

  1. If statement
  2. If else statement
  3. Nested If statement
  4. If else-if lader statement

If Statement In C++

if We want to perform conditional work with the only true statement then, if statement is best for us.

Syntax of if statement


Simple example of if statement in c++

Check A Number Is Positive

#include <iostream>
using namespace std;
int main(){
int x;
cout<<“Enter a Number:”;
cin>>x; //this statemetnt use input number from console
cout<<“Number is Positive:”<
return 0;

Enter a Number : 3
Number is Positive: 3

If you like this post, don’t forget to share 🙂

This article is written by our awesome writer
Comments to: If Statement In Cpp

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

New Dark Mode Is Here

Sign In to access the new Dark Mode reading option.

Join our Newsletter

Get our monthly recap with the latest news, articles and resources.

By subscribing you agree to our Privacy Policy.

Latest Articles

Explore Tutorials By Categories


Codeverb is simply an all in one interactive learning portal, we regularly add new topics and keep improving the existing ones, if you have any suggestions, questions, bugs issue or any other queries you can simply reach us via the contact page


Welcome to Codeverb

Ready to learn something new?
Join Codeverb!

Read Smart, Save Time
    Strength indicator
    Log In | Lost Password