daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**** PONG ****/
  2. // Ported from 1.2.2 (C)
  3. // To 1.0 (C++, using Object Orientation)
  4. // For: Research Project HIT2080
  5. // Joel Rozen-Oxley 7536372
  6.  
  7. // Includes
  8. // #include <stdlib.h>
  9. // #include "SwinGame.h"
  10. #include <iostream>
  11. using namespace std;
  12.  
  13. class ball {
  14.  
  15. public:
  16.     ball(int vals[]);
  17.  
  18.     int radius;
  19.     int delta_x;
  20.     int delta_y;
  21.     int max_speed;
  22.     int old_x_centre;
  23.     int new_x_centre;
  24.     int old_y_centre;
  25.     int new_y_centre;
  26.  
  27. };
  28.  
  29.  ball::ball(int vals[]){
  30.  
  31.     radius = vals[0];
  32.     delta_x = vals[1];
  33.     delta_y = vals[2];
  34.     max_speed = vals[4];
  35.     old_x_centre = vals[5];
  36.     new_x_centre = vals[6];
  37.     old_y_centre = vals[7];
  38.     new_y_centre = vals[8];
  39. }
  40.  
  41.  
  42.  
  43. int main() {
  44.  
  45.     int create_vals[] = {1, 2, 3, 4, 5, 6, 7, 8 ,9};
  46.  
  47.     //initialize while creating object
  48.     ball b = ball(create_vals);
  49.  
  50.     //print default values
  51.     cout << "Radius = "    << b.radius    << "\n";
  52.     cout << "Max Speed = " << b.max_speed << "\n";
  53.  
  54.     //Change values
  55.      cout << "\n" << "Changing the values" << "\n\n";
  56.      b.radius = 20;
  57.      b.max_speed = 50;
  58.  
  59.     //print again
  60.     cout << "Radius = "    << b.radius    << "\n";
  61.     cout << "Max Speed = " << b.max_speed << "\n";
  62.  
  63.     return 0;
  64. }
RAW Paste Data
Top