Thursday, June 24, 2010
Wednesday, June 23, 2010
prosesor terbaru
Core i7 resmi diluncurkan dalam tiga versi quad-core. Ditilik dari harganya, Core i7 memang tidak murah. Namun jika Anda ingin merakit PC dengan sistem Core i7, Anda memang harus membayar mahal. Untuk sistem, pilihan Anda saat ini masih terbatas pada motherboard dengan chipset Intel X58 (dengan ICH10 southbridge) dan memori DDR3. Harga keduanya pun belum murah.
Namun prosesor baru ini menawarkan beberapa fitur baru, antara lain kendali memori yang terintegrasi dan moda Turbo baru. Hyperthreading juga muncul kembali, menambahkan empat inti virtual ke empat inti fisik yang ada di CPU Core i7.
Moda Turbo, yang disebut Dynamic Speed Technology, memungkinkan CPU untuk mematikan inti dan meningkatkan clock speed, yang bisa bermanfaat pada aplikasi-aplikasi lama yang membutuhkan megahertz lebih, bukan inti yang lebih banyak. Pada aplikasi muti-threaded, CPU akan menyeimbangkan beban di semua inti.
CPU baru ini memiliki 731 juta transistor dalam satu die berukuran 263 milimeter persegi. Semua prosesor Core i7 dirancang pada daya desain thermal 130 watt. Antarmuka Quick Path Interconnect menyediakan bandwidth 19,2 gigatransfer pre detik pada model 920 dan 940, dan 25,6 gigatransfer pada model Extreme Edition.
Processor Name | Cores | Clock | Cache | QPI/FSB | TDP | 1Ku Price |
| Intel Core i7 Extreme 965 | 4 | 3.20GHz | 8MB | 3200MHz | 150W | $999 |
| Intel Core i7 940 | 4 | 2.93GHz | 8MB | 2400MHz | 130W | $562 |
| Intel Core i7 920 | 4 | 2.66GHz | 8MB | 2400MHz | 130W | $284 |
| Intel Core 2 Extreme QX9775 | 4 | 3.20GHz | 2 x 6MB | 1600MHz | 150W | $1,499 |
| Intel Core 2 Extreme QX9770 | 4 | 3.20GHz | 2 x 6MB | 1600MHz | 136W | $1,399 |
| Intel Core 2 Extreme Q9650 | 4 | 3.00GHz | 2 x 6MB | 1333MHz | 130W | $530 |
| Intel Core 2 Quad Q9550 | 4 | 2.83GHz | 2 x 6MB | 1333MHz | 95W | $316 |
| Intel Core 2 Quad Q9450 | 4 | 2.66GHz | 2 x 6MB | 1333MHz | 95W | $316 |
| Intel Core 2 Quad Q9400 | 4 | 2.66GHz | 2 x 3MB | 1333MHz | 95W | $266 |
| Intel Core 2 Quad Q9300 | 4 | 2.50GHz | 2 x 3MB | 1333MHz | 95W | $266 |
| Intel Core 2 Quad Q8200 | 4 | 2.33GHz | 2 x 2MB | 1333MHz | 95W | $193 |
Namun prosesor baru ini menawarkan beberapa fitur baru, antara lain kendali memori yang terintegrasi dan moda Turbo baru. Hyperthreading juga muncul kembali, menambahkan empat inti virtual ke empat inti fisik yang ada di CPU Core i7.
Moda Turbo, yang disebut Dynamic Speed Technology, memungkinkan CPU untuk mematikan inti dan meningkatkan clock speed, yang bisa bermanfaat pada aplikasi-aplikasi lama yang membutuhkan megahertz lebih, bukan inti yang lebih banyak. Pada aplikasi muti-threaded, CPU akan menyeimbangkan beban di semua inti.
CPU baru ini memiliki 731 juta transistor dalam satu die berukuran 263 milimeter persegi. Semua prosesor Core i7 dirancang pada daya desain thermal 130 watt. Antarmuka Quick Path Interconnect menyediakan bandwidth 19,2 gigatransfer pre detik pada model 920 dan 940, dan 25,6 gigatransfer pada model Extreme Edition.
virus baru
Nah, berikut ini 10 virus terganas Fabruari 2010 - update terbaru dari Kaspersky Lab. Semoga informasi ini bermanfaat bagi anda, sehingga mulai sekarang mulailah mengantisipasi virus-virus terbaru 2010. Update antivirus anda sekarang juga. Untuk virus-virus lokal, saya rekomendasikan SmadAV 2010 Ref 8
Top 10 Virus - Malware name Hits
1. P2P-Worm.Win32.Polip.a
2. Packed.Win32.Krap.an
3. Trojan-Dropper.Win32.Boaxxe.bm
4. HEUR:Trojan.Win32.Generic
5. Trojan-Downloader.Win32.Agent.dbfs
6. Net-Worm.Win32.Kido.ih
7. Packed.Win32.Krap.ag
8. not-a-virus:AdWare.Win32.Zwangi.ch
9. not-a-virus:AdWare.Win32.EZula.heur
10. not-a-virus:AdWare.Win32.Agent.lmz
Top 10 Virus - Malware name Hits
1. P2P-Worm.Win32.Polip.a
2. Packed.Win32.Krap.an
3. Trojan-Dropper.Win32.Boaxxe.bm
4. HEUR:Trojan.Win32.Generic
5. Trojan-Downloader.Win32.Agent.dbfs
6. Net-Worm.Win32.Kido.ih
7. Packed.Win32.Krap.ag
8. not-a-virus:AdWare.Win32.Zwangi.ch
9. not-a-virus:AdWare.Win32.EZula.heur
10. not-a-virus:AdWare.Win32.Agent.lmz
Tuesday, June 15, 2010
so dari google(google chrome)
1. Blazing fast
Chrome actually uses WebKit for rendering Web pages, the same rendering engine as Safari (
), which is known to be very fast. Put that in a simple, well optimized, stripped down shell and you get the fastest Web browser around. It loads fast, it displays pages fast, and we’re talking noticeable differences here, which really makes it a joy to use. Don’t just take my word for it, check out some early benchmarks.
2. Chews code like there’s no tomorrow

This one goes hand in hand with being fast, but it’s a little different. Today, it’s not all that important for a browser to render a lot of HTML quickly; browsers are now platforms in which you run applications: two, three, perhaps even a dozen at a time. Therefore, a good browser can handle dynamic content without stuttering and crashing, and from what I’ve seen, Chrome passes the test with flying colors.
True, I haven’t had enough time to test this thoroughly, but the folks over at scriptNode have put together some benchmarks and it seems that Chrome not only handles good code well, it also excels at handling errors.
3. Incognito mode
Click the control icon in the upper right corner of the browser and you’ll get the option to open a new tab, a new window, or a new incognito window. Incognito window will fire up without appearing in browser or search history, and it won’t leave cookies or any other traces of your activity, except files you’ve downloaded or bookmarks. Yes, Safari has it, too, but it’s a nice jab at Firefox (
) which skipped some similar privacy features in version 3.0.
4. Easy to switch
When you’re entering a saturated market with a new product, you can’t change everything. You must carefully balance the features you want to blatantly copy with the ones you want to innovate in. I was pleased to see that Google Chrome (
) was built with this in mind; for example, it’s easy to switch from Firefox, but it does bring enough novelties to make you stick around. Importing your bookmarks from Firefox is easy and works well; and other details, like keyboard shortcuts, are the same. Therefore, Chrome’s learning curve is virtually non-existent; start it up and you’ll be browsing as usual in no time.
5. Intelligent start page

Although not completely original (Opera (
) has got a similar approach to quick bookmarking), Chrome’s start page is a pleasant surprise. Besides the ubiquitous search bar, it gives you a list of most commonly visited Web pages to fire up quickly. Granted, I’ve always hated suggestions of that ilk (for example, I’ve never, ever used the commonly used programs feature in Windows (
)), but here it just works, because the pages you frequently visit really are the ones you want to open first.
6. Has its own task manager
Chrome treats tabbed windows as separate processes. Nice, we’ve already seen that in IE8, right? But Chrome also has a nifty way to see what’s going on: a task manager. Similar to the task manager in Windows, it lets you see which processes are active (inside Chrome), and how much memory, CPU, and network resources they use. Beautiful. You can access it by right clicking Chrome’s title bar.
7. Dragging tabs out and back in again

It’s a little thing, but it warms my heart. You can drag a tab out of Chrome into a separate window, and you can drag a separate window back into tab bar, where it’ll be happily received by Chrome. Stuff like this turns geeks into converts, and Google’s dev team knows that.
Feel free to let us know which are your favorite (or least favorite) features of Chrome in the comments!
Chrome actually uses WebKit for rendering Web pages, the same rendering engine as Safari (
2. Chews code like there’s no tomorrow

This one goes hand in hand with being fast, but it’s a little different. Today, it’s not all that important for a browser to render a lot of HTML quickly; browsers are now platforms in which you run applications: two, three, perhaps even a dozen at a time. Therefore, a good browser can handle dynamic content without stuttering and crashing, and from what I’ve seen, Chrome passes the test with flying colors.
True, I haven’t had enough time to test this thoroughly, but the folks over at scriptNode have put together some benchmarks and it seems that Chrome not only handles good code well, it also excels at handling errors.
3. Incognito mode
Click the control icon in the upper right corner of the browser and you’ll get the option to open a new tab, a new window, or a new incognito window. Incognito window will fire up without appearing in browser or search history, and it won’t leave cookies or any other traces of your activity, except files you’ve downloaded or bookmarks. Yes, Safari has it, too, but it’s a nice jab at Firefox (
4. Easy to switch
When you’re entering a saturated market with a new product, you can’t change everything. You must carefully balance the features you want to blatantly copy with the ones you want to innovate in. I was pleased to see that Google Chrome (
5. Intelligent start page

Although not completely original (Opera (
6. Has its own task manager
Chrome treats tabbed windows as separate processes. Nice, we’ve already seen that in IE8, right? But Chrome also has a nifty way to see what’s going on: a task manager. Similar to the task manager in Windows, it lets you see which processes are active (inside Chrome), and how much memory, CPU, and network resources they use. Beautiful. You can access it by right clicking Chrome’s title bar.
7. Dragging tabs out and back in again

It’s a little thing, but it warms my heart. You can drag a tab out of Chrome into a separate window, and you can drag a separate window back into tab bar, where it’ll be happily received by Chrome. Stuff like this turns geeks into converts, and Google’s dev team knows that.
Feel free to let us know which are your favorite (or least favorite) features of Chrome in the comments!
Friday, June 11, 2010
contoh program selection sort descending c++
#include
#include
void main() {
int i, j, iMax; //Deklarasi index untuk array
int n, Urut; //Deklarasi untuk banyak data
int Tmp; //Tmp penampung elemen array
int Arr[50]; //Deklarasi Array
//Aplikasi dimulai
printf("Inputkan banyak data yang akan diurutkan : ");
scanf("%i", &n);
//Input array
Urut = 1;
for(i = 0; i < n; i++) { //Perulangan untuk inputan array
printf("Masukan data ke %i : ", i + 1);
scanf("%i", &Arr[i]);
}
//Lakukan sorting descanding dengan metode selection
for(i = 0; i < n - 1; i++) { //n - 1 artinya elm terakhir tidak dihitung
iMax = i; //Set max = index array
for(j = Urut; j < n; j++) { //Lakukan perulangan sebagai pembanding
if(Arr[j] > Arr[iMax]) { //Cari data yang besar
iMax = j; //max diganti dengan yang lebih besar
if(Arr[i] != Arr[iMax]) { //Cek untuk data yang berbeda
Tmp = Arr[i]; //Tampung Array yang lama
if(Arr[i] < Arr[iMax]) { //Jika Array lama lebih besar dari yang baru
Arr[i] = Arr[iMax]; //Ganti Array lama dengan Array baru
Arr[iMax] = Tmp; //Ganti Array baru dengan Array lama
}
}
}
}
Urut = Urut + 1; //Tambah urut dengan 1
}
//Tampilkan Hasil
printf("\nSetelah Pengurutan\n");
for(i = 0; i < n; i++) { //Perulangan untuk tampilan Array
printf("Elemen ke %i : %i\n", i + 1, Arr[i]);
}
getch(); //Tahan tampilan
}
#include
void main() {
int i, j, iMax; //Deklarasi index untuk array
int n, Urut; //Deklarasi untuk banyak data
int Tmp; //Tmp penampung elemen array
int Arr[50]; //Deklarasi Array
//Aplikasi dimulai
printf("Inputkan banyak data yang akan diurutkan : ");
scanf("%i", &n);
//Input array
Urut = 1;
for(i = 0; i < n; i++) { //Perulangan untuk inputan array
printf("Masukan data ke %i : ", i + 1);
scanf("%i", &Arr[i]);
}
//Lakukan sorting descanding dengan metode selection
for(i = 0; i < n - 1; i++) { //n - 1 artinya elm terakhir tidak dihitung
iMax = i; //Set max = index array
for(j = Urut; j < n; j++) { //Lakukan perulangan sebagai pembanding
if(Arr[j] > Arr[iMax]) { //Cari data yang besar
iMax = j; //max diganti dengan yang lebih besar
if(Arr[i] != Arr[iMax]) { //Cek untuk data yang berbeda
Tmp = Arr[i]; //Tampung Array yang lama
if(Arr[i] < Arr[iMax]) { //Jika Array lama lebih besar dari yang baru
Arr[i] = Arr[iMax]; //Ganti Array lama dengan Array baru
Arr[iMax] = Tmp; //Ganti Array baru dengan Array lama
}
}
}
}
Urut = Urut + 1; //Tambah urut dengan 1
}
//Tampilkan Hasil
printf("\nSetelah Pengurutan\n");
for(i = 0; i < n; i++) { //Perulangan untuk tampilan Array
printf("Elemen ke %i : %i\n", i + 1, Arr[i]);
}
getch(); //Tahan tampilan
}

contoh program selection sort ascending c++
Oke ... langsung saja .. Semoga membantu
#include
#include
void main() {
int i, j, iMin; //Deklarasi index untuk array
int n, Urut; //Deklarasi untuk banyak data
int Tmp; //Tmp penampung elemen array
int Arr[50]; //Deklarasi Array
//Aplikasi dimulai
printf("Inputkan banyak data yang akan diurutkan : ");
scanf("%i", &n);
//Input array
Urut = 1;
for(i = 0; i < n; i++) { //Perulangan untuk inputan array
printf("Masukan data ke %i : ", i + 1);
scanf("%i", &Arr[i]);
}
//Lakukan sorting ascending dengan metode selection
for(i = 0; i < n - 1; i++) { //n - 1 artinya elm terakhir tidak dihitung
iMin = i; //Set min = index array
for(j = Urut; j < n; j++) { //Lakukan perulangan sebagai pembanding
if(Arr[j] < Arr[iMin]) { //Cari data yang kecil
iMin = j; //min diganti dengan yang lebih kecil
if(Arr[i] != Arr[iMin]) { //Cek untuk data yang berbeda
Tmp = Arr[i]; //Tampung Array yang lama
if(Arr[i] >Arr[iMin]) { //Jika Array lama lebih besar dari yang baru
Arr[i] = Arr[iMin]; //Ganti Array lama dengan Array baru
Arr[iMin] = Tmp; //Ganti Array baru dengan Array lama
}
}
}
}
Urut = Urut + 1; //Tambah urut dengan 1
}
//Tampilkan Hasil
printf("\nSetelah Pengurutan\n");
for(i = 0; i < n; i++) { //Perulangan untuk tampilan Array
printf("Elemen ke %i : %i\n", i + 1, Arr[i]);
}
getch(); //Tahan tampilan
}
#include
#include
void main() {
int i, j, iMin; //Deklarasi index untuk array
int n, Urut; //Deklarasi untuk banyak data
int Tmp; //Tmp penampung elemen array
int Arr[50]; //Deklarasi Array
//Aplikasi dimulai
printf("Inputkan banyak data yang akan diurutkan : ");
scanf("%i", &n);
//Input array
Urut = 1;
for(i = 0; i < n; i++) { //Perulangan untuk inputan array
printf("Masukan data ke %i : ", i + 1);
scanf("%i", &Arr[i]);
}
//Lakukan sorting ascending dengan metode selection
for(i = 0; i < n - 1; i++) { //n - 1 artinya elm terakhir tidak dihitung
iMin = i; //Set min = index array
for(j = Urut; j < n; j++) { //Lakukan perulangan sebagai pembanding
if(Arr[j] < Arr[iMin]) { //Cari data yang kecil
iMin = j; //min diganti dengan yang lebih kecil
if(Arr[i] != Arr[iMin]) { //Cek untuk data yang berbeda
Tmp = Arr[i]; //Tampung Array yang lama
if(Arr[i] >Arr[iMin]) { //Jika Array lama lebih besar dari yang baru
Arr[i] = Arr[iMin]; //Ganti Array lama dengan Array baru
Arr[iMin] = Tmp; //Ganti Array baru dengan Array lama
}
}
}
}
Urut = Urut + 1; //Tambah urut dengan 1
}
//Tampilkan Hasil
printf("\nSetelah Pengurutan\n");
for(i = 0; i < n; i++) { //Perulangan untuk tampilan Array
printf("Elemen ke %i : %i\n", i + 1, Arr[i]);
}
getch(); //Tahan tampilan
}
contoh program buble sort c++
#include
#include
int data[10],data2[10];
int n;
void tukar(int a, int b)
{
int t;
t = data[b];
data[b] = data[a];
data[a] = t;
}
void bubble_sort()
{
for(int i=1;i<=n;i++)
{
for(int j=n; j>=i; j--)
{
if(data[j] < data[j-1]) tukar(j,j-1);
}
}
}
void main()
{
cout<<"===PROGRAM BUBBLE SORT==="<
//Input Data
cout<<"Masukkan Jumlah Data : ";
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<"Masukkan data ke "<<<" : ";
cin>>data[i];
//data2[i]=data[i];
}
bubble_sort();
cout<<"\n\n";
//tampilkan data
cout<<"Data Setelah di Sort : ";
for(i=1; i<=n; i++)
{
cout<<" "<
}
cout<<"\n\nSorting Selesai";
getch();
}
#include
int data[10],data2[10];
int n;
void tukar(int a, int b)
{
int t;
t = data[b];
data[b] = data[a];
data[a] = t;
}
void bubble_sort()
{
for(int i=1;i<=n;i++)
{
for(int j=n; j>=i; j--)
{
if(data[j] < data[j-1]) tukar(j,j-1);
}
}
}
void main()
{
cout<<"===PROGRAM BUBBLE SORT==="<
//Input Data
cout<<"Masukkan Jumlah Data : ";
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<"Masukkan data ke "<<<" : ";
cin>>data[i];
//data2[i]=data[i];
}
bubble_sort();
cout<<"\n\n";
//tampilkan data
cout<<"Data Setelah di Sort : ";
for(i=1; i<=n; i++)
{
cout<<" "<
}
cout<<"\n\nSorting Selesai";
getch();
}
CONTOH PROGRAM QUICK SORT C++
#include
#include
#define n 7
void main ()
{
int A[n]={15,10,7,22,17,5,12};
int X,I,K;
printf("Sebelum di-Sort \n");
for (I=0; I<=n-1; I++)
printf("%3i",A[I]);
printf("\n");
K=0;
while (K <=n-2)
{
I=0;
while(I<=n-2-K)
{
if(A[I]>A[I+1])
{
X=A[I];
A[I]=A[I+1];
A[I+1]=X;
}
I++;
}
K++;
}
printf ("Sesudah di Sort\n");
for(I=0; I<=n-1; I++);
printf("%3d",A[I]);
}
#include
#define n 7
void main ()
{
int A[n]={15,10,7,22,17,5,12};
int X,I,K;
printf("Sebelum di-Sort \n");
for (I=0; I<=n-1; I++)
printf("%3i",A[I]);
printf("\n");
K=0;
while (K <=n-2)
{
I=0;
while(I<=n-2-K)
{
if(A[I]>A[I+1])
{
X=A[I];
A[I]=A[I+1];
A[I+1]=X;
}
I++;
}
K++;
}
printf ("Sesudah di Sort\n");
for(I=0; I<=n-1; I++);
printf("%3d",A[I]);
}
Thursday, June 3, 2010
menggunakan cout dalam c++
To print a value to the screen, write the word cout, followed by the insertion operator (<<), which you create by typing the less-than character (<) twice. Even though this is two characters, C++ treats it as one.
Follow the insertion character with your data. Listing below illustrates how this is used. Type in the example exactly as written, except substitute your own name where you see Baski (unless your name is Baski, in which case leave it just the way it is; it's perfect).
Using cout.
causes the iostream.h file to be added to your source code. This is required if you use cout and its related functions.
On line 6 is the simplest use of cout, printing a string or series of characters. The symbol \n is a special formatting character. It tells cout to print a newline character to the screen.
Three values are passed to cout on line 7, and each value is separated by the insertion operator. The first value is the string "Here is 5: ". Note the space after the colon. The space is part of the string. Next, the value 5 is passed to the insertion operator and the newline character (always in double quotes or single quotes). This causes the line
On line 8, an informative message is printed, and then the manipulator endl is used. The purpose of endl is to write a new line to the screen. (Other uses for endl are discussed on Day 16.)
On line 9, a new formatting character, \t, is introduced. This inserts a tab character and is used on lines 8-12 to line up the output. Line 9 shows that not only integers, but long integers as well can be printed. Line 10 demonstrates that cout will do simple addition. The value of 8+5 is passed to cout, but 13 is printed.
On line 11, the value 5/8 is inserted into cout. The term (float) tells cout that you want this value evaluated as a decimal equivalent, and so a fraction is printed. On line 12 the value 7000 * 7000 is given to cout, and the term (double) is used to tell cout that you want this to be printed using scientific notation. All of this will be explained on Day 3, "Variables and Constants," when data types are discussed.
On line 14, you substituted your name, and the output confirmed that you are indeed a C++ programmer. It must be true, because the computer said so!
source:baski
Follow the insertion character with your data. Listing below illustrates how this is used. Type in the example exactly as written, except substitute your own name where you see Baski (unless your name is Baski, in which case leave it just the way it is; it's perfect).
Using cout.
1: // Listing 2.2 using cout 2: 3: #includeOn line 3, the statement #include4: int main() 5: { 6: cout << "Hello there.\n"; 7: cout << "Here is 5: " << 5 << "\n"; 8: cout << "The manipulator endl writes a new line to the screen." << Âendl; 9: cout << "Here is a very big number:\t" << 70000 << endl; 10: cout << "Here is the sum of 8 and 5:\t" << 8+5 << endl; 11: cout << "Here's a fraction:\t\t" << (float) 5/8 << endl; 12: cout << "And a very very big number:\t" << (double) 7000 * 7000 << Âendl; 13: cout << "Don't forget to replace Baski with your name...\n"; 14: cout << "Baski is a C++ programmer!\n"; 15: return 0; 16: } Hello there. Here is 5: 5 The manipulator endl writes a new line to the screen. Here is a very big number: 70000 Here is the sum of 8 and 5: 13 Here's a fraction: 0.625 And a very very big number: 4.9e+07 Don't forget to replace Baski with your name... Baski is a C++ programmer!
On line 6 is the simplest use of cout, printing a string or series of characters. The symbol \n is a special formatting character. It tells cout to print a newline character to the screen.
Three values are passed to cout on line 7, and each value is separated by the insertion operator. The first value is the string "Here is 5: ". Note the space after the colon. The space is part of the string. Next, the value 5 is passed to the insertion operator and the newline character (always in double quotes or single quotes). This causes the line
Here is 5: 5to be printed to the screen. Because there is no newline character after the first string, the next value is printed immediately afterwards. This is called concatenating the two values.On line 8, an informative message is printed, and then the manipulator endl is used. The purpose of endl is to write a new line to the screen. (Other uses for endl are discussed on Day 16.)
On line 9, a new formatting character, \t, is introduced. This inserts a tab character and is used on lines 8-12 to line up the output. Line 9 shows that not only integers, but long integers as well can be printed. Line 10 demonstrates that cout will do simple addition. The value of 8+5 is passed to cout, but 13 is printed.
On line 11, the value 5/8 is inserted into cout. The term (float) tells cout that you want this value evaluated as a decimal equivalent, and so a fraction is printed. On line 12 the value 7000 * 7000 is given to cout, and the term (double) is used to tell cout that you want this to be printed using scientific notation. All of this will be explained on Day 3, "Variables and Constants," when data types are discussed.
On line 14, you substituted your name, and the output confirmed that you are indeed a C++ programmer. It must be true, because the computer said so!
source:baski
c++ iostreamm library
The iostream library is an object-oriented library that provides input and output functionality using streams.
A stream is an abstraction that represents a device on which input and ouput operations are performed. A stream can basically be represented as a source or destination of characters of indefinite length.
Streams are generally associated to a physical source or destination of characters, like a disk file, the keyboard, or the console, so the characters gotten or written to/from our abstraction called stream are physically input/output to the physical device. For example, file streams are C++ objects to manipulate and interact with files; Once a file stream is used to open a file, any input or output operation performed on that stream is physically reflected in the file.
To operate with streams, C++ provides the standard iostream library, which contains the following elements:
Objects:
Types:
Manipulators:
http://cplusplus.com
A stream is an abstraction that represents a device on which input and ouput operations are performed. A stream can basically be represented as a source or destination of characters of indefinite length.
Streams are generally associated to a physical source or destination of characters, like a disk file, the keyboard, or the console, so the characters gotten or written to/from our abstraction called stream are physically input/output to the physical device. For example, file streams are C++ objects to manipulate and interact with files; Once a file stream is used to open a file, any input or output operation performed on that stream is physically reflected in the file.
To operate with streams, C++ provides the standard iostream library, which contains the following elements:
- Basic class templates
- The base of the iostream library is the hierarchy of class templates. The class templates provide most of the functionality of the library in a type-independent fashion. This is a set of class templates, each one having two template parameters: the char type (charT) parameter, that determines the type of elements that are going to be manipulated and the traits parameter, that provides additional characteristics specific for a particular type of elements. The class templates in this class hierarchy have the same name as their char-type instantiations but with the prefix basic_. For example, the class template which istream is instantiated from is called basic_istream, the one from which fstream is is called basic_fstream, and so on... The only exception is ios_base, which is by itself type-independent, and therefore is not based on a template, but is a regular class.
- Class template instantiations
- The library incorporates two standard sets of instantiations of the entire iostream class template hierarchy: one is narrow-oriented, to manipulate elements of type char and another one, wide-oriented, to manipulate elements of type wchar_t. The narrow-oriented (char type) instantiation is probably the better known part of the iostream library. Classes like ios, istream and ofstream are narrow-oriented. The diagram on top of this page shows the names and relationships of narrow-oriented classes. The classes of the wide-oriented (wchar_t) instatiation follow the same naming conventions as the narrow-oriented instantiation but with the name of each class and object prefixed with a w character, forming wios, wistream and wofstream, as an example.
- Standard objects
- As part of the iostream library, the header file
declares certain objects that are used to perform input and output operations on the standard input and output. They are divided in two sets: narrow-oriented objects, which are the popular cin, cout, cerr and clog and their wide-oriented counterparts, declared as wcin, wcout, wcerr and wclog. - Types
- The iostream classes barely use fundamental types on their member's prototypes. They generally use defined types that depend on the traits used in their instantiation. For the default char and wchar_t instantiations, types streampos, streamoff and streamsize are used to represent positions, offsets and sizes, respectively.
- Manipulators
- Manipulators are global functions designed to be used together with insertion (<<) and extraction (>>) operators performed on iostream stream objects. They generally modify properties and formatting settings of the streams. endl, hex and scientific are some examples of manipulators.
Organization
The library and its hierarchy of classes is split in different files:, , , and aren't usually included directly in most C++ programs. They describe the base classes of the hierarchy and are automatically included by other header files of the library that contain derived classes. declares the objects used to communicate through the standard input and output (including cin and cout). defines the file stream classes (like the template basic_ifstream or the class ofstream) as well as the internal buffer objects used with these (basic_filebuf). These classes are used to manipulate files using streams. : The classes defined in this file are used to manipulate string objects as if they were streams. declares some standard manipulators with parameters to be used with extraction and insertion operators to modify internal flags and formatting options.
Compatibility notes
The names, prototypes and examples included in this reference for the iostream classes mostly describe and use the char instantiations of the class templates instead of the templates themselves, even though these classes are only one of their possible instantiations. We believe this provides a better readability and is arguably as easy to obtain the names and prototypes of the basic template from the char instantiation as the opposite.Elements of the iostream library (char instantitation)
Classes:| ios_base | Base class with type-independent members for the standard stream classes (class) |
| ios | Base class with type-dependent members for the standard stream classes (class) |
| istream | Input stream (class) |
| ostream | Output Stream (class) |
| iostream | Input/Output Stream (class) |
| ifstream | Input file stream class (class) |
| ofstream | Output file stream (class) |
| fstream | Input/output file stream class (class) |
| istringstream | Input string stream class (class) |
| ostringstream | Output string stream class (class) |
| stringstream | Input/output string stream class (class) |
| streambuf | Base buffer class for streams (class) |
| filebuf | File stream buffer (class) |
| stringbuf | String stream buffer (class) |
Objects:
| cin | Standard input stream (object) |
| cout | Standard output stream (object) |
| cerr | Standard output stream for errors (object) |
| clog | Standard output stream for logging (object) |
Types:
| fpos | Stream position class template (class template) |
| streamoff | Stream offset type (type) |
| streampos | Stream position type (type) |
| streamsize | Stream size type (types) |
Manipulators:
| boolalpha | Alphanumerical bool values (manipulator function) |
| dec | Use decimal base (manipulator function) |
| endl | Insert newline and flush (manipulator function) |
| ends | Insert null character (manipulator function) |
| fixed | Use fixed-point notation (manipulator function) |
| flush | Flush stream buffer (manipulator function) |
| hex | Use hexadecimal base (manipulator function) |
| internal | Adjust field by inserting characters at an internal position (manipulator function) |
| left | Adjust output to the left (manipulator function) |
| noboolalpha | No alphanumerical bool values (manipulator function) |
| noshowbase | Do not show numerical base prefixes (manipulator function) |
| noshowpoint | Do not show decimal point (manipulator function) |
| noshowpos | Do not show positive signs (manipulator function) |
| noskipws | Do not skip whitespaces (manipulator function) |
| nounitbuf | Do not force flushes after insertions (manipulator function) |
| nouppercase | Do not generate upper case letters (manipulator function) |
| oct | Use octal base (manipulator function) |
| resetiosflags | Reset format flags (manipulator function) |
| right | Adjust output to the right (manipulator function) |
| scientific | Use scientific notation (manipulator function) |
| setbase | Set basefield flag (manipulator function) |
| setfill | Set fill character (manipulator function) |
| setiosflags | Set format flags (manipulator function) |
| setprecision | Set decimal precision (manipulator function) |
| setw | Set field width (manipulator function) |
| showbase | Show numerical base prefixes (manipulator function) |
| showpoint | Show decimal point (manipulator function) |
| showpos | Show positive signs (manipulator function) |
| skipws | Skip whitespaces (manipulator function) |
| unitbuf | Flush buffer after insertions (manipulator function) |
| uppercase | Generate upper-case letters (manipulator function) |
| ws | Extract whitespaces (manipulator function) |
http://cplusplus.com
contoh program selection c++
dalam c++, dikenal 2 buah seleksi percabangan, yaitu dengan menggunakan if dan case.
contoh 1
#include
#include
#include
void main() {
int nilai;
cout<<"Masukkan nilai : ";cin>>nilai;
cout<
if (nilai>50) {
{
cout<<"Selamat, Anda lulus ...";
}
getch();
}
contoh 2
#include
#include
#include
void main() {
int nilai;
cout<<"Masukkan nilai : ";cin>>nilai;
cout<
if (nilai>50) {
cout<<"Selamat, Anda Lulus...";
}
else {
cout<<"Maaf, Anda gagal...";
}
getch();}
contoh 3
#include
#include
#include
void main() {
int angka;cout<<"Masukkan angka : "; cin>>angka;
cout<
if ((angka>0)&&(angka<10)) {
cout<<"Anda memasukkan angka antara 1 sampai 9";
}
else {
cout<<"Yang anda masukkan bukan antara 1 sampai 9";
}
getch();
}
contoh 4
#include
#include
#include
void main() {
int huruf;cout<<"Masukkan huruf kecil : "; cin>>huruf;
cout<
cout<<"Anda memasukkan huruf vokal";
}
else {
cout<<"Yang anda masukkan adalah huruf konsonan";
}
getch();
}
contoh 1
#include
#include
#include
void main() {
int nilai;
cout<<"Masukkan nilai : ";cin>>nilai;
cout<
if (nilai>50) {
{
cout<<"Selamat, Anda lulus ...";
}
getch();
}
contoh 2
#include
#include
#include
void main() {
int nilai;
cout<<"Masukkan nilai : ";cin>>nilai;
cout<
if (nilai>50) {
cout<<"Selamat, Anda Lulus...";
}
else {
cout<<"Maaf, Anda gagal...";
}
getch();}
contoh 3
#include
#include
#include
void main() {
int angka;cout<<"Masukkan angka : "; cin>>angka;
cout<
if ((angka>0)&&(angka<10)) {
cout<<"Anda memasukkan angka antara 1 sampai 9";
}
else {
cout<<"Yang anda masukkan bukan antara 1 sampai 9";
}
getch();
}
contoh 4
#include
#include
#include
void main() {
int huruf;cout<<"Masukkan huruf kecil : "; cin>>huruf;
cout<
cout<<"Anda memasukkan huruf vokal";
}
else {
cout<<"Yang anda masukkan adalah huruf konsonan";
}
getch();
}


11:06 PM
ijun