Review


Problem 1
Compute the output of the program.
Calcule la salida del programa.

Program.h
#pragma once //______________________________________ Program.h
#include "resource.h"

class Program: public Win::Dialog
{
public:
     Program()
     {
     }
     ~Program()
     {
     }
     struct Point
     {
          double x;
          double y;
          double z;
     };
     void Show(Point point);
protected:
     ...
};

Program.cpp
void Program::Window_Open(Win::Event& e)
{
     Point a;
     a.x = 1.2;
     a.y = 2.1;
     a.z = 2.4;
     Show(a);
}

void Program::Show(Point point)
{
     wstring text;
     Sys::Format(text,
          L"x = %f, y = %f, z = %f",
           point.x, point.y, point.z);
     this->MessageBox(text, L"A Point", MB_OK);
}

Problem 2
Compute the output of the program.
Calcule la salida del programa.

Program.h
#pragma once //______________________________________ Program.h
#include "resource.h"

class Program: public Win::Dialog
{
public:
     Program()
     {
     }
     ~Program()
     {
     }
     struct Point
     {
          double x;
          double y;
          double z;
     };
     void Show(Point* point);
protected:
     ...
};

Program.cpp
void Program::Window_Open(Win::Event& e)
{
     Point a;
     a.x = 1.2;
     a.y = 2.1;
     a.z = 2.4;
     Show(&a);
     Show(&a);
}

void Program::Show(Point* point)
{
     wstring text;
     Sys::Format(text,
          L"x = %f, y = %f, z = %f",
           point->x, point->y, point->z);
     this->MessageBox(text, L"A Point", MB_OK);
     point->x++;
}

Problem 3
Compute the output of the program.
Calcule la salida del programa.

Program.h
#pragma once //______________________________________ Program.h
#include "resource.h"

class Program: public Win::Dialog
{
public:
     Program()
     {
     }
     ~Program()
     {
     }
     struct Point
     {
          double x;
          double y;
          double z;
     };
     void Display(Point* point);
     void Analyze(Point point);
     void Process(Point& point);
     void Generate(Point* point);
protected:
     ...
};

Program.cpp
void Program::Window_Open(Win::Event& e)
{
     Point a, b, c;
     a.x = 1.2;
     a.y = 2.1;
     a.z = 2.4;
     b=a;
     c=a;
     Analyze(a);
     Process(b);
     Generate(&c);
     Display(&a);
     Display(&b);
     Display(&c);
}

void Program::Display(Point *point)
{
     wstring texto;
     Sys::Format(texto,
          L"x = %f, y = %f, z = %f", point->x, point->y, point->z);
     this->MessageBox(texto, L"Point", MB_OK);
}

void Program::Analyze(Point point)
{
     point.x = 10.0;
     point.y++;
}

void Program::Process(Point& point)
{
     point.x = 1.0;
     point.y--;
}

void Program::Generate(Point* point)
{
     point->x = 3.0;
     point->z = point->y;
}

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home