c++ Operator dalam Program

contoh 1:
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
void main ( )
 {
Int a, b, c = 0, d = 0 ;
cout <<”Masukkan Nilai A : “; cin>>a;
cout <<”Masukkan Nilai B : “; cin>>b;
c = a % b;
d = a * b;
cout <<”Hasil dari C = A % B = “<<c<< endl ;
cout <<”Hasil dari D = A * B = “<<d<< endl;
   getch ( ) ;
}



Contoh 2 :
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
void main ( )
 {
Int a = 10, b = 5 ;
printf(”Nilai A = %d”, a);
printf(”\nNilai ++A = %d”, ++a);
printf(”\nNilai A = %d”, a);
printf(”\n\nNilai B = %d”, b);
printf(”\nNilai — B = %d”, –b);
printf(”\nNilai B = %d”, b);
getch ( ) ;
}

No comments:

Post a Comment