Home » » Member Functions

Member Functions

Written By Unknown on Minggu, 22 Januari 2012 | 04.53

Lab RPL .
With C++ as many other Languange , there are what's called member functions. they are " Pre-made" by the languange that you are using . in general, they are part of the class it comes from. all member functions are accedes with teh fot operator ( . )

with the cout class, there are member functions that control output formating. Let's see the count strean and some of it's member functions.

Widht ( numCharacters )
sets the spacing of of the output in terms of the number of characters ( the argument). The width is valid only on the next cout statment .
Here is An example :

#include <iostream.h>
int main ()
{
cout<< "www.rekayasa-perangkat-lunak.info";
cout.width ( 11 );
cout<<" Bye ";
return 0;
}

The width set 11 spaces for the "www.rekayasa-perangkat-lunak.info" string. then , the "www.rekayasa-perangkat-lunak.info" string will print with no restriction in terms of size.
The output is :
            www.rekayasa-perangkat-lunak.info                        Bye

0 komentar:

Posting Komentar