contoh program pemakaian operator
//contoh program pemakaian operator ++ dg peletakan di belakang variabel
#include<iostream.h>
#include<conio.h>
void main()
{
int r = 10 ;
int s;
clrscr();
//s = 10 + ++r;
s = 10 + ++r ;
cout << "r = "<< r <<endl;
cout << "s = "<< s <<endl;
getch();
}
//contoh program memakai manipulator endl dan setw
#include<iostream.h>
#include<conio.h>
#include <iomanip.h> //utk manipulasi setw()
/* void main()
{
int jumbar = 150 ;
jumbar = 23;
jumbar = 1500;
clrscr();
cout <<"barang 1 = "<<setw(4)<<jumbar1<<endl;
cout <<"barang 2 = "<<setw(4)<<jumbar2<<endl;
cout <<"barang 3 = "<<setw(4)<<jumbar3<<endl;
getch();
}
*/
0 komentar:
Post a Comment