trougao.h
- Kod: Označi sve
class Trougao
{
public:
Trougao(void);
Trougao(int,int,int);
~Trougao(void);
int getA();
int getB();
int getC();
void setA(int);
void setC(int);
void setB(int);
private:
int a;
int b;
int c;
}
trougao.cpp
- Kod: Označi sve
#include "stdafx.h"
#include "Trougao.h"
Trougao::Trougao(void)
{
}
Trougao::Trougao(int a,int b,int c){
this->a=a;
this->b=b;
this->c=c;
}
Trougao::~Trougao(void)
{
}
int Trougao::getA()
{
return this->a ;
}
int Trougao::getB()
{
return this->b ;
}
int Trougao::getC()
{
return this->c ;
}
void Trougao::setA(int a)
{
this->a = a;
}
void Trougao::setB(int b)
{
this->b = b;
}
void Trougao::setC(int c)
{
this->c = c;
}
Main klasa nece da izbaci upisane podatke
- Kod: Označi sve
#include <iostream>
#include <string>
#include "trougao.h"
#include "trougao.cpp"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Trougao t(2,4,7);
cout<<t.getA()<<endl;
cout<<t.getB()<<endl;
return 0;
}