Home > Daspro > Operator Penambah & Pengurang

Operator Penambah & Pengurang

Operator Pemnambah (++) dan Pengurang (–)

#include <iostream.h>
#include <conio.h>

void main()
{
   int a, b, c, d;
   gotoxy(14,2);cout<<"Program Operator Penambah dan Pengurang";
   gotoxy(10,3);cout<<"----------------------------------------------";
   gotoxy(10,5);cout<<"Inputkan Nilai A : "; cin>>a;
   gotoxy(10,6);cout<<"Inputkan Nilai B : "; cin>>b;
   gotoxy(10,7);cout<<"Inputkan Nilai C : "; cin>>c;
   gotoxy(10,8);cout<<"Inputkan Nilai D : "; cin>>d;
   gotoxy(10,10);cout<<"Nilai A         : " << a;
   gotoxy(10,11);cout<<"Nilai A++       : " << a++;
   gotoxy(10,12);cout<<"Nilai A Akhir   : " << a;
   gotoxy(35,10);cout<<"Nilai B         : " << b;
   gotoxy(35,11);cout<<"Nilai ++B       : " << ++b;
   gotoxy(35,12);cout<<"Nilai B Akhir   : " << b;
   gotoxy(10,15);cout<<"Nilai C         : " << c;
   gotoxy(10,16);cout<<"Nilai C--       : " << c--;
   gotoxy(10,17);cout<<"Nilai C Akhir   : " << c;
   gotoxy(35,15);cout<<"Nilai D         : " << d;
   gotoxy(35,16);cout<<"Nilai --D       : " << --d;
   gotoxy(35,17);cout<<"Nilai D Akhir   : " << d;
   getch();
}
About these ads
Categories: Daspro
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: