Icon New game New game

Programming

Fill in the Blanks

Practice Programming

Download the paper version to play

Recommended age: 17 years old
5 times made

Created by

United States

Top 10 results

  1. 1
    03:16
    time
    99
    score
Do you want to stay in the Top 10 of this game? to identify yourself.
Make your own free game from our game creator
Compete against your friends to see who gets the best score in this game

Top Games

  1. time
    score
  1. time
    score
time
score
time
score
 
game-icon

Fill in the Blanks

ProgrammingOnline version

Practice Programming

by Liz Smith
1

GetSode area namespace bool is side GetArea #include cout const initSide Square s1 void endl side side operator> initSide s2 of int s1 SetSide square side The return side

Purpose : Overload operators for a class type as inline number functions


/ / for standard i / o
using std ; / / reserve library objects for standard use

/ / declare the Square class type to model a square
class Square
{
public :
Square ( ) { = 1 ; } / / the default constructor that initialize the side to 1
Square ( ) { = ; } / / the explicit constructor that initialize the side to a parameter
int ( ) { return side ; } / / get the side of the square
( int newSide ) { side = newSide ; } / / change the side of the
int GetArea ( ) const { return * ; } / / get the area of the square
( Square rhs ) const { > rhs . side ; } / / the greater operator
private :
int side ; / / the side of a square
} ;

int main ( )
{
, / / declared ( created ) by us the default constructor
s2 ( 3 ) ; / / declare ( created ) by using the explicit constructor
/ / display the area of s1 and s2
cout << " " << s1 . GetArea ( ) << endl ;
<< " The area of s2 is " << . ( ) < s2 )
cout << " s1 is bigger than s2 " < ( s2 ) )
else ;
cout << " s1 id not bigger than s2 " << ;

/ / successfully done
return 0 ;
}

educaplay suscripción