e6390af40fd246928c9f6b67562cf0fa37712fa8

8/23/2017

How To Use If Statement and nested if statement in C++ Programming Language

In this post we will discuss how to use if else statement in c++ programming language.The if and else are like a coin having two faces only.If  we toss a coin then there will be only two choices one is head and other is tail and we select the one head or a tail.If statement have also two choices only one is if and other is a else. that will be selected on your condition to which one is run if or else.

The other example of if else is like a street or a road having only two ways to move forward and we select the one that is true that depends on the condition we used.This is like as

In this  example we have a point where we are standing and want to move forward and we have only one choice to select a way for us.Examples of the if else statement are given bellow.

Syntax:
                  #include<iostream>
          using namespace std;   //header files
          void main() 
         {

            if(condition)
             {
              //body of if.
             }
            else
             {
              //body of else
             }

         }//body of main.

Example 1:
Write a program to check that the given number is Even number or Odd number.

Solution:
#include<iostream>
using namespace std;   //header files
void main() 
{
       int num;  //num stand for number
      
       cout<<"Enter a number :"<<endl;   //message
      
       cin>>num; //taking input from the user.

       if(num%2==0) //this is our condition to check the even number..because every even                          //number completely divisible by 2 and give remainder 0.                          
       {
               cout<<num<<" is Even Number"<<endl;
       }
       else
       {
              cout<<num<<" is Odd Number"<<endl;
       }
   
   cout<<"\n\n\n"<<endl;  //used for next line.
       system("pause");

}//body of main.


Example 2:
Write a program to check that the given number is a Leap Year or not.

Solution:
#include<iostream>
using namespace std;   //header files
void main() 
{
       int year; 
      
       cout<<"Enter a year :"<<endl;   //message to display
      
       cin>>year; //taking input from the user.

       if(year%4==0) //this is our condition to check the leap year...because every 4 yaer                         //  after  the month of febrary is 29 days.
       {
              cout<<year<<" IS A LEAP YEAR"<<endl;
       }
       else
       {
              cout<<year<<" IS NOT A LEAP YEAR"<<endl;
       }
   
   cout<<"\n\n\n"<<endl;  //used for next line.
       system("pause");


}//body of main.
















TAGS:

if, programming, else, structure, java, if else, tutorial, decision, conditional, elseif, then, excel vba tutorial, excel vba example, excel vba examples, code, vb, science, computer, c++, if-else, control flow, control, visual studio, visual basic, condition, control structure, c language, learn java, java tutorial, branching statements, decisions, javascript, syntax, conditions, php, if else statement, structures, how to program, control structures, c (programming language), statement, vba, c programming, beginners, python, language, or, basic, script, nested if, simple if, introduction, else if, 2010, control structures in c++, java if else, if statements, visual basic for applications, features, high-level, kanthety, saradhi, sundeep, java tutorials, flowchart, how to use for loop in java, how to use for loop in laravel, how to use for loop in android studio, how to use for loop in c++, how to use for loop in excel, how to use for loop in jquery, how to use for loop in php, if-else block, branching, matlab, if conditions, java branching, java programming, if block, c program, pgc lectures:, java example, mechanical engineering, microsoft excel (software), university, java course, how to, statements, learn to code, indentation, coding, scripting language, lectures, how to use for loop in javascript, how to use for loop in matlab, how to use for loop in c programming, how to use for loop in python, how to use for loop in vba, how to use for loop in c++ in hindi, 

8/21/2017

How to Create Mathematical Formulas Using C++ Source Code

In this basic c++ programming tutorial we will discus how to create simple programs and mathematical formulas in c++.First of all we understand how to calculate a2 using code.So a squire means multiplying a with a then it will be a2. So using same method we can calculate band by multiplying 2 with a and b that gives us complete formula a2 +2ab+b2.



Source Code Examples in the c++:

Formula for the  
                        (a+b)2 =a+2ab+b2

#include<iostream>
using namespace std;
void main()
{ //start of main

          int a;
          int b;
          int result;
 
         cout<<" Enter Value of  a"<<endl;
         cin>>a;
         cout<<" Enter Value of  b"<<endl;
         cin>>b;
       
          result=( (a*a)+2*a*b+(b*b));
       
          cout<<" The Result is : "<<result<<endl;
         
system("pause");  //this is use to stope console screen

   } //end of main

  _____________________________Example 2_______________________________________

Formula for the        
               (a-b)2 =a-2ab+b2

#include<iostream>
using namespace std;
void main()
{ //start of main

          int a;
          int b;
          int result;
 
         cout<<" Enter Value of  a"<<endl;
         cin>>a;
         cout<<" Enter Value of  b"<<endl;
         cin>>b;
       
          result=( (a*a)-2*a*b+(b*b));
       
          cout<<" The Result is : "<<result<<endl;
         
system("pause");  //this is use to stope console screen

   } //end of main
  _____________________________Example 3_______________________________________

Formula for the

            a3+b3=(a+b)( a2-ab+b2)

#include<iostream>
using namespace std;
void main()
{ //start of main

          int a;
          int b;
          int result;

         cout<<" Enter Value of  a"<<endl;
         cin>>a;
         cout<<" Enter Value of  b"<<endl;
         cin>>b;
     
          result=((a+b)*( (a*a)-a*b+(b*b)));
     
          cout<<" The Result is : "<<result<<endl;
       
system("pause");  //this is use to stope console screen

   } //end of main

_____________________________Example 4_______________________________________

Formula for the
               a3-b3=(a-b)( a2+ab+b2)
#include<iostream>
using namespace std;
void main()
{ //start of main

          int a;
          int b;
          int result;

         cout<<" Enter Value of  a"<<endl;
         cin>>a;
         cout<<" Enter Value of  b"<<endl;
         cin>>b;
     
          result=((a-b)*( (a*a)+a*b+(b*b)));
     
          cout<<" The Result is : "<<result<<endl;
       
system("pause");  //this is use to stope console screen

   } //end of main







TAGS:

c++, tutorial, programming, program, learn, cpp, basics, beginner, introduction, tpayne, lets, let's, computer science, guide, series, begin, intro, intermediate, beginners, types, data, variables, simple, how, to, c++ language, input, compiler, c (programming language), c++ tutorial, c++ programming, functions, pointers, operator, experience, nested if statements in c++,22,30], nested if-else in c++ example, arrays, hacking, while loop, technology, switch, if, string, computer, nested if else in c++ program, syntax of nested if in c++, nested if in c++, nested if in c++ ppt, c++ video tutorial, classes, programming language (software genre), keyboard, nested if in c++ meaning, nested if in c++, c++ interview questions, multiple if in c++, instillation, nested if in c++ programming, nested if else in c++ programming examples, if else nested in c in a for loop, example for nested if in c, nested if else statements in c++,22,30], nested if in c++ pdf, software (industry), learn c++ language, bloodsheddev, learn c++ programming, helloworld, c++ programming tutorials, c++ programming tutorial for beginners, c++ programming tutorial complete, c++ programming tutorila hindi, c++ tutorials complete, c++ tutorials from basic to advance, free c++ programming tutorial hindi, c++ programming tutorial, jackktutorials, onestopprogramming, all c++ programming tutorial hindi, c++ tutorials hindi, address of, how to make a snake game, decrement, אוניברסיטת תל אביב, 


8/20/2017

How To Use cout and cin in the c++ programming

In this post we will discus how to create a simple cout and cin  source code in c programming language.
In the c++ programming language the cout is used to display any message do you want to display as an output. The cin is used to take input from the user at required points.

How to use cout?


The word cout pronounce as c out and these are taken as c  from the c++ programming language and out from input  (standard output stream). The word cout is used to display or show the data do you want to display.In the console screen the message is displayed which you write on the cout  double "".The compiler move forward and read next line in source code after reading it.The source code of cout statement is given bellow.

#include<iostream>
using namespace std;
int main()
{
cout<<"  Hello Guys "<<endl;
        cout<<" This is you4c.blogspot.com "<<endl;

      return 0;
}

How to use cin?
The word cin pronounce as c in and these are taken as c  from the c++ programming language and in from input  (standard input stream). The word cin is used to take input from the user using keyboard.In the console screen their is a _ cursor that is blinking to take input from the user.When the user give input and press enter then the compiler move forward and read next line in source code.The source code of cin statement is given bellow.

#include<iostream>
using namespace std;
int main()
{
         int num;

cout<<" Please Enter a Number. "<<endl;
        cin>>num;
        cout<<"You Enter This number."<<num<<endl;

      return 0;
}

8/19/2017

What is the data type in c++ programming language

In this post we will discus some basic c programs that will help to learn to code c++ programming language.In c programming language there are five datatypes but we discus three data types like int, float, char. 
                                   " Data types is a type of variable to store data  in it "

What is int?


int is taken from the word integer that is used in mathematics and other places in our daily life.The int storage size is 4 bytes.The integer value only store in the variables that having data type int.how to declare an integer in c programming language.
                                             int a=10;   int b=5;
Here we declare two integer variables a and b that contains two values of  10 and 20.How to check the size of the int via source code in c++.

                  #include<iostream>
                  using namespace std;
                  int main()
                 {
           cout<<" Size of  int  is : "<< sizeof(int) <<endl;
               
                   return 0;
                 }

What is float?

 
float is a floating point that is used in mathematics the floating values are only stored in the floats we  can store 4 bytes in it. How to declare an float variable in c programming language.
                                              float c=5; float d=6;
Here we declare two float variables c and d that contains two values of 5 and 6.How to check the size of the float via source code in c++.

                  #include<iostream>
                  using namespace std;
                  int main()
                 {
           cout<<" Size of  float  is : "<< sizeof(float) <<endl;
               
                   return 0;
                 }

What is char?

char is taken from the word characters that are contains alphabets, mark, dollar sign, hash, at the rate and all other like as ~,@,#, $,%,^,&  and all other on your key board instead of numbers.there are 255 character including number having ASCII. Char can store only one byte in it.
                                                char c='@';    char ch='*';
here we declare two characters c and ch having values @ and *.How to check the size of the char via source code in c++.

                  #include<iostream>
                  using namespace std;
                  int main()
                 {
           cout<<" Size of  char is : "<< sizeof(char) <<endl;
               
                   return 0;
                 }

How to create a new project

How to create a new project in visual studio.In this post of c programming help we help you to  create a new project.There are few steps perform to create a new project. First of all click on the visual studio when it will be opened then perform the following steps.
1.Click on the File menu.
2.Click new then click on the new project
3.Write the name of your project selecting an empty project
4.Also select your project location where do you have to store it.
5.Now click on your project that is opened on the left or right side in pane.if that is not present the do  these things.
6.Click on the View menu and click on the solution explorer.
7.Now Right click on your project and click on the add and add a .cpp file in your project.
8.Now a white screen is display there you can code.

8/18/2017

Introduction To The C++ Language

What is the C++??


When we hear about c++ the first question in our mind is that what is c++?  The answer is that the C++ is programming language that is easy to learn for human beings and also for the computers.

 "The formal way to explaining a computer how to perform the given set of instructions"

In introduction to the C programming language their are some basic points to understand in the c++ language. if you understand these basic point than that is easy to you program a c code..

Points:

1.How to install visual studio/div c++/turbo c etc.
2.what is cout (c out)?
3.what is cin (c in)?
4.how to use operators?
5.use of if else if
6.use of Loops
7.use of switch 
8.use of goto
9.use of continue
10.and all other
We will discus these points one by one with detail and complete c++ code.you will consider it online c programming course that helps you to learn c++.

Privacy Policy for Apps

Privacy Policy Muhammad Shahbaz built the Health Physio Association app as a Free app. This SERVICE is provided by Muhammad Shahbaz at no...