Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- struct vec3d {
- float x, y, z;
- void print(){
- cout << x << " " << y << " " << z << endl;
- }
- vec3d add (vec3d a){
- vec3d b;
- b.x=x+a.x;
- b.y=y+a.y;
- b.z=z+a.z;
- return b;
- }
- };
- #include <string>
- /*
- struct Dog {
- //properties
- string name;
- bool home;
- // constructors
- Dog(string name_) {
- name = name_;
- home = true;
- }
- Dog() {
- name = "Homeless";
- home = false;
- }
- // methods
- void bark(){
- if (home) {
- cout << "Woof! My name is " << name << endl;
- }
- else {
- cout << "Woof! I am homeless" << endl;
- }
- }
- };
- */
- struct Cat {
- string name;
- Cat (string name_){
- name = name_;
- }
- void m(){
- cout << " "
- }
- };
- int main(int argc, char *argv[]){
- /*
- vec3d a;
- a.x = 4;
- a.y = 1;
- a.z = 9;
- */
- Dog d("Dusty");
- d.bark();
- Dog f("Fluffy");
- f.bark();
- Dog g;
- g.bark();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement