Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab05

Snippet info

Language

Cpp

Visibility

public

Author

lucasr.o5437

Created

2022-09-09T23:16:46.303429Z

Updated

2022-09-09T23:17:44.190379Z

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



class Somatorio{
   public:
    int A;
    int soma = 0;



    Somatorio (int B){
          for (A = 0; A <= B; A++){
           
            soma += A;
          }
    }
    
    void setSomatorio(int soma){
        soma = 0;
    }
    
    int getSomatorio(){
        return soma;
    }
       
    };
        



int main() {
    Somatorio obj(5); // obj é o objeto da classe Teste01
    obj.setSomatorio(10);
    
    cout << obj.getSomatorio() << "\n";
    return 0;
}
INFO