/*
Increment and Decrement Operator
===============================
++ - Increment Operator
-- - Decrement Operator
++a - Pre Increment
a++ - Post Increment
--a - Pre Decrement
a-- - Post Decrement
*/
#include<iostream.h>
#include<conio.h>
main()
{
int a=10,b;
clrscr();
b=a++;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
b=++a;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
b=a--;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
b=--a;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
getch();
}
Increment and Decrement Operator
===============================
++ - Increment Operator
-- - Decrement Operator
++a - Pre Increment
a++ - Post Increment
--a - Pre Decrement
a-- - Post Decrement
*/
#include<iostream.h>
#include<conio.h>
main()
{
int a=10,b;
clrscr();
b=a++;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
b=++a;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
b=a--;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
b=--a;
cout<<"\n B value is "<<b;
cout<<"\n A value is "<<a;
getch();
}
No comments:
Post a Comment