Quick actions

cmd+k|ctrl+k

Navigation

Languages

Lab06.2

Snippet info

Language

Cpp

Visibility

public

Author

rafaela.toniatto

Created

2022-09-02T23:45:19.921032Z

Updated

2022-09-02T23:45:19.921032Z

#include <iostream>
using namespace std;
// Lab06 - implementar com  funções do lab04.1

class ParImpar{
    public:
    int a;
    
     ParImpar (int b){
         a = b;
        if (a % 2 == 0){
            cout << " par";
        }else{
           cout << " impar";
        }
}

void setParImpar(int a){
     a = 0;
}

int getParImpar(){
    return a;
}
};

int main(){
        ParImpar obj(5);
        obj.setParImpar(3);
        
        cout << obj.getParImpar() << "\n";
        
        return 0;
       
}
INFO