Icon Crear Crear

Practice Programming

Completar frases

Practice Programs

Descarga la versión para jugar en papel

Edad recomendada: 17 años
6 veces realizada

Creada por

Estados Unidos

Top 10 resultados

  1. 1
    01:48
    tiempo
    100
    puntuacion
¿Quieres aparecer en el Top 10 de este juego? para identificarte.
Crea tu propio juego gratis desde nuestro creador de juegos
Compite contra tus amigos para ver quien consigue la mejor puntuación en esta actividad

Top juegos

  1. tiempo
    puntuacion
  1. tiempo
    puntuacion
tiempo
puntuacion
tiempo
puntuacion
 
game-icon

Completar frases

Practice ProgrammingVersión en línea

Practice Programs

por Liz Smith
1

move iostream cout endl Print x pt newY temp moving main x temp newX int int return int Print new location namespace Point pt int int p

Purpose : pass a struct to a function and return a struct variable


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

/ / declare the Point to represent a 2D point

struct Point
{
; / / the x coordinate
int y ; / / the y coordinate

} ;

void ( ) ; / / to print a point in the format of ( x , y )

Point ( Point , , ) ; / / to move a point to a new location


int ( )
{
Point pt = { 1 , 2 } ; / / the given point

/ / display the point before moving
<< " Before , = " ;
Print ( pt ) ;
cout << endl ;

/ / move the point to ( 3 , 6 )
pt = move ( pt , 3 , 6 ) ;


/ / display the point after moving
cout << " After moving , pt = " ;
( ) ;
cout << ;

/ / successfully done
return 0 ;
}

void Print ( Point p )
/ / to print a point
{
cout << " ( " << . << " , " << p . y << " ) " ; / / print the format of ( x , y )
}
Point move ( Point p , , )
/ / to move a point
{
/ / point temp ;

/ / temp . x = newX ;
/ / temp . y = newY ;
Point = { newX , newY } ; / / a temporary point at a
;


}

educaplay suscripción