Skip to main content

Prefix and Post fix

Prefix and Post fix

#include<iostream>     // it is  a library used for display
#include<conio.h>      // its is also a library used for input output statement
using namespace std;
// Prefix increment and post fix increment
main()

{
int a=3,b=4;
cout<<".........Prefix increment.........."<<endl;
cout<<"previous value of b="<<b<<endl;   // as we know what is happening here
 cout<<++b<<"=due to prefix increment"<<endl;          /*as form the name prefix increment its increment value before using it in the program
                      like b=4 so ++b mean increment a value before its get use */
cout<<".........Post fix increment.........."<<endl;

cout<<"previous value of a="<<endl;  // as we know what is happening here
cout<<"value of a is =\t"<<a++<<"\\t although ++ sign is there"<<endl;
 cout<<"now here its get increment="<<a<<endl; /* here the value is first incremented then used in the program in the next
                                               statement*/
}
/* Task:
Do same process with for the decrements operator use same codding but just replace ++ sign
with -- sign */



Comments

Popular posts from this blog

Variable And INT

#include<iostream>     // it is  a library used for display #include<conio.h>      // its is also a library used for input output statement using namespace std; main() { int a;                           /* what is (int) here and what is (a) here                    the two question which was in mind of me                    when i was in first semester*/                   } /* Here there are two thing 2) int 1) a: is basically a Variable which represent a storage or memory in computer like if we define (int a) then a memory is located in computer to store the value of a it can be changed during execution of program but i will define it later 2) int 2) INT : int basically specifies the type of da...

Introduction to PHP

Introduction to php: PHP stands for Hypertext Preprocessor. Other Names : Personal Home Page, Professional Home Page Is a server side scripting language. Capable of generating the HTML pages HTML generates the web page with the static text and images. However the need evolved for dynamic web based application, mostly involving database usage. Why world need php: There are number of server side scripting available like ASP, SSJS, JSP….. PHP involves simplicity in scripting (..generally using the database) platform independence. PHP is primarily designed for web applications well optimized for the response times needed for web applications Is an open source. Data types of php: Three basic data types Integer Double String More data types Array Object PHP is an untyped language variables type can change on the fly.