-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREZA PAGE 70-71-72.cpp
More file actions
57 lines (47 loc) · 1.36 KB
/
Copy pathREZA PAGE 70-71-72.cpp
File metadata and controls
57 lines (47 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
contoh penggunaan setiosflags()
*/
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main()
{
intx = 520;
cout<<"x ditampilkan dengan ios::left "<<endl;
cout<<setiosflags(ios::left)<<setw(10)<<x<<endl<<endl;
cout<<"x ditampilka dengan ios::left "<<endl;
cout<<setiosflags(ios::right)<<setw(10)<<x<<endl<,endl;
float y = 123.456;
cout<<"y ditampilkan dengan ios::fixed "<<endl;
cout<<setiosflags(ios::fixed)<<y<<endl<<endl;
cout<<resetiosflags(ios::fixed);
cout<,"y ditampilkan dengan ios::scientific"<<endl;
cout<<setiosflags(ios::scientific)<<y<<endl<<endl;
cout<<resetiosflags(ios::scientific);
int bil = 51;
cout<<"tnpa ios::showbase : "<<endl;
cout<<oct<<bil<<endl;
cout<<dec<<bil<<endl;
cout<hex<<bill<<endl;
cout<hex<<bil<endl;
cout<<"dengan ios::showbase : "<<endl;
cout<<setiosflags(ios::showbase);
cout<<oct<<bil<<endl;
cout<<hex<<bil<<endl;
cout<<"\ndengan ios::upperrcase untuk heksadesimal
"<<endl;
cout<<setiosflags(ios::uppercase)<<bil<<endl;
cout<<resetiosflags(ios::showbase);
cout<<resetiosflags(ios::uppercase);
float a = 234.00;
cout<<"\ntanpa ios::showpoint :n "<<endl;
cout<<setiosflags(ios::showpoint)<<a<<endl;
cout<<resetiosflags(ios::showpoint);
int b = 27;
cout<<"\ntanpa ios::showpos : "<<endl;
cout<<b<<endl<<endl;
cout<<"dengan ios::showpos : "<<endl;
cout<<setiosflags(ios::showpos)<<b<<endl;
cout<<resetiosflags(ios::showpos);
getch();
{