Examples of C + + programs

1. The program displays the personal biodata

# include
# include

Biodata class (
public:
void print ();
);

2nd. The program displays the format month-date-time

# include
# include

class format_tgl (
friend ostream & operator <<(ostream &, const format_tgl &); friend istream & operator>> (istream &, format_tgl &);
private:
int date;
int month;
int year;

3. Program to print characters forming star letter I

# include
class letter (
public: out put
(){;} letter
void print ();
private:
int i;

4. The program calculates area, circumference and volume of the ball

# include
# include

class Ball (
friend istream & operator>> (istream &, Ball &);
friend ostream & operator <<(ostream &, Ball &);
public:
void area () (result = (2 * 22 * r) / 7;)
void around () (hasil2 = (4 * 22 * r * r) / 7;)
void volume () (hasil3 = (4 * 22 * r * r * r) / 21;)
0 Komentar untuk "Examples of C + + programs"

Back To Top