code stringlengths 1 2.08M | repo_name stringlengths 1 35 | path stringlengths 4 221 | language stringclasses 66
values | license stringclasses 17
values | size int64 1 2.08M |
|---|---|---|---|---|---|
#include "CPolygon.h"
void CPolygon::setValues(int a, int b){
width = a;
height = b;
} | 2112110124 | Example13/CPolygon.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 94 |
#include <iostream>
using namespace std;
class CPolygon{
protected:
int width, height;
public:
void setValues(int a, int b);
}; | 2112110124 | Example13/CPolygon.h | C | Microsoft Reciprocal License (Ms-RL) | 142 |
#include "CPolygon.h"
#include "CRectangle.h"
int CRectangle::area(){
return(width * height);
} | 2112110124 | Example13/CRectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 102 |
#include <iostream>
//#include "CPolygon.h"
using namespace std;
class CRectangle: public CPolygon{
public:
int area();
}; | 2112110124 | Example13/CRectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 133 |
#include "CPolygon.h"
#include "CTriangle.h"
int CTriangle::area(){
return(width * height/2);
} | 2112110124 | Example13/CTriangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 102 |
#include <iostream>
//#include "CPolygon.h"
using namespace std;
class CTriangle: public CPolygon{
public:
int area();
}; | 2112110124 | Example13/CTriangle.h | C | Microsoft Reciprocal License (Ms-RL) | 132 |
#include "CPolygon.h"
#include "CRectangle.h"
#include "CTriangle.h"
#include <conio.h>
int main(){
CRectangle rect;
CTriangle trgl;
rect.setValues(4,5);
trgl.setValues(4,5);
cout << rect.area() << endl;
cout << trgl.area() << endl;
_getch();
return 0;
} | 2112110124 | Example13/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 278 |
#include "CRectangle.h"
void CRectangle::setValues(int a, int b){
width = a;
height = b;
}
int CRectangle::area(){
return(width *height);
} | 2112110124 | Example14/CRectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 151 |
#include <iostream>
using namespace std;
class CRectangle{
protected:
int width;
int height;
public:
void setValues(int a, int b);
public:
int area();
}; | 2112110124 | Example14/CRectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 176 |
#include "CTriangle.h"
void CTriangle::setValues(int a, int b){
width = a;
height = b;
}
int CTriangle::area(){
return (width * height / 2);
} | 2112110124 | Example14/CTriangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 154 |
#include <iostream>
using namespace std;
class CTriangle{
protected:
int width;
int height;
public:
void setValues(int a, int b);
int area();
}; | 2112110124 | Example14/CTriangle.h | C | Microsoft Reciprocal License (Ms-RL) | 165 |
#include "CRectangle.h"
#include "CTriangle.h"
#include <conio.h>
int main(){
CRectangle rect;
CTriangle trgl;
rect.setValues(4,5);
trgl.setValues(4,5);
cout << "area Rectangle: " << rect.area() << endl;
cout << "area Triangle: " << trgl.area() <<endl;
_getch();
return 0;
} | 2112110124 | Example14/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 296 |
#include "Shape.h"
#include "Rectangle.h"
#include "Triangle.h"
#include <conio.h>
//#ifndef Shape.h
//#define "Shape.h"
int main(){
Rectangle rect;
Triangle trgl;
//Shape(3,6);
cout << "a: " << rect.area();
cout << "b: " << trgl.area();
_getch();
return 0;
}
//#endif | 2112110124 | Example15/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 290 |
#include "Rectangle.h"
int Rectangle::area(){
return(width * heigh);
} | 2112110124 | Example15/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 76 |
#include "Shape.h"
#include <iostream>
using namespace std;
class Rectangle: public Shape{
public:
int area();
}; | 2112110124 | Example15/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 124 |
#include "Shape.h"
Shape::Shape(int a, int b){
width = a;
heigh = b;
} | 2112110124 | Example15/Shape.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 78 |
#include <iostream>
using namespace std;
class Shape{
protected:
int width ;
int heigh;
/*public:
Shape(int a, int b);*/
}; | 2112110124 | Example15/Shape.h | C | Microsoft Reciprocal License (Ms-RL) | 141 |
#include "Triangle.h"
int Triangle::area(){
return(width * heigh /2);
} | 2112110124 | Example15/Triangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 77 |
#include "Shape.h"
#include <iostream>
using namespace std;
class Triangle: public Shape{
public:
int area();
}; | 2112110124 | Example15/Triangle.h | C | Microsoft Reciprocal License (Ms-RL) | 123 |
#include "CPolygon.h"
CPolygon::CPolygon(int a)
{
width =a;
}
void CPolygon::setValues(int a, int b)
{
width = a;
height = b;
} | 2112110124 | Example16/CPolygon.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 141 |
#include <iostream>
using namespace std;
class CPolygon
{
protected:
int width;
int height;
public:
CPolygon(int a);
void setValues(int a, int b);
}; | 2112110124 | Example16/CPolygon.h | C | Microsoft Reciprocal License (Ms-RL) | 165 |
#include "CPolygon.h"
#include "CRectangle.h"
CRectangle::CRectangle(int w, int h):CPolygon(w)
{
height = h;
}
int CRectangle::area()
{
return(width * height);
} | 2112110124 | Example16/CRectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 174 |
#include <iostream>
using namespace std;
class CRectangle:public CPolygon
{
public:
CRectangle(int w, int h);
int area();
}; | 2112110124 | Example16/CRectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 135 |
#include "CPolygon.h"
#include "CRectangle.h"
#include <conio.h>
int main()
{
CRectangle rect(8, 9);
cout << rect.area() << endl;
_getch();
return 0;
} | 2112110124 | Example16/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 166 |
#include <iostream>
#include <string.h>
using namespace std;
class Daughter
{
public:
void display();
}; | 2112110124 | Example17/Daughter.h | C | Microsoft Reciprocal License (Ms-RL) | 114 |
#include "Mother.h"
void Display{} | 2112110124 | Example17/Mother.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 37 |
#include <iostream>
#include <string.h>
using namespace std;
/*class Mother
{
private:
void display();
};
*/ | 2112110124 | Example17/Mother.h | C | Microsoft Reciprocal License (Ms-RL) | 119 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 4);
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
Rectangle Rect2 = ++Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl;
cout << ... | 2112110124 | Example19/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 441 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Recta... | 2112110124 | Example19/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 738 |
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void setWidth(doubl... | 2112110124 | Example19/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 430 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 4);
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
Rectangle Rect2 = Rect1 ++;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl;
cout <<... | 2112110124 | Example20/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 440 |
#include "Rectangle.h"
Rectangle::Rectangle() :width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Recta... | 2112110124 | Example20/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 762 |
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void setWidth(doubl... | 2112110124 | Example20/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 431 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 4);
Rectangle Rect4 = --Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl;
cout << "Rect4 width: " << Rect4.getWidth() << " and height: " << Rect4.getHeight() << endl;
_getch();
retu... | 2112110124 | Example21/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 328 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Recta... | 2112110124 | Example21/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 736 |
//Prefix-- operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
vo... | 2112110124 | Example21/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 447 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 4);
Rectangle Rect5 = Rect1--;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect5 width: " << Rect5.getWidth() << " and height: " << Rect5.getHeight() << endl;
_getch()... | 2112110124 | Example22/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 336 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Recta... | 2112110124 | Example22/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 761 |
//Postfix -- operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle {
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;... | 2112110124 | Example22/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 453 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rectangle Rect6 = Rect1 + Rect2;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect... | 2112110124 | Example23/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 472 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = height;
}
Rectangle::~Rectangle(){
}... | 2112110124 | Example23/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 853 |
//+ operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void se... | 2112110124 | Example23/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 461 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rectangle Rect6 = Rect1 - Rect2;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect... | 2112110124 | Example24/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 472 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example24/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 862 |
//- operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void se... | 2112110124 | Example24/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 461 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rectangle Rect6 = Rect1 * Rect2;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect... | 2112110124 | Example25/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 472 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example25/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 862 |
// * operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void s... | 2112110124 | Example25/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 462 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rectangle Rect6 = Rect1 / Rect2;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect... | 2112110124 | Example26/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 472 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example26/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 862 |
// / operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void s... | 2112110124 | Example26/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 462 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2 = Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect2.getHeight() << endl;
_getch();... | 2112110124 | Example27/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 335 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example27/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 789 |
// = operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void s... | 2112110124 | Example27/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 464 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rect2 += Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect2.getHeight() << ... | 2112110124 | Example28/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 352 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example28/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 792 |
// += operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void ... | 2112110124 | Example28/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 466 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rect2 -= Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect2.getHeight() << ... | 2112110124 | Example29/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 352 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example29/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 792 |
// -= operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void ... | 2112110124 | Example29/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 466 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rect2 *= Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect2.getHeight() << ... | 2112110124 | Example30/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 352 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example30/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 758 |
// *= operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void ... | 2112110124 | Example30/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 466 |
#include "Rectangle.h"
#include <conio.h>
int main(){
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
Rect2 /= Rect1;
cout << "Rect1 width: " << Rect1.getWidth() << " and height: " << Rect1.getHeight() << endl << endl;
cout << "Rect2 width: " << Rect2.getWidth() << " and height: " << Rect2.getHeight() << ... | 2112110124 | Example31/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 352 |
#include "Rectangle.h"
Rectangle::Rectangle(): width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectang... | 2112110124 | Example31/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 757 |
// /= operator
#include <iostream>
#include <cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void ... | 2112110124 | Example31/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 465 |
#include"Rectangle.h"
#include<conio.h>
int main()
{
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
if (Rect1 > Rect2)
cout << "Rect1>Rect2" << endl;
else
cout << "Rect1<Rect2" << endl;
_getch();
return 0;
}
| 2112110124 | Example32/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 232 |
#include"Rectangle.h"
Rectangle::Rectangle() :width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectangle(){... | 2112110124 | Example32/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 731 |
// > OPERATOR
#include<iostream>
#include<cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void setWidt... | 2112110124 | Example32/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 444 |
#include"Rectangle.h"
#include<conio.h>
int main()
{
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
if (Rect1 >= Rect2)
cout << "Rect1>=Rect2" << endl;
else
cout << "Rect1<Rect2" << endl;
_getch();
return 0;
}
| 2112110124 | Example33/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 234 |
#include"Rectangle.h"
Rectangle::Rectangle() :width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectangle(){... | 2112110124 | Example33/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 733 |
// >=
#include<iostream>
#include<cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void setWidth(double... | 2112110124 | Example33/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 438 |
#include"Rectangle.h"
#include<conio.h>
int main()
{
Rectangle Rect1(5, 25);
Rectangle Rect2(4, 20);
if (Rect1 <= Rect2)
cout << "Rect1<=Rect2" << endl;
else
cout << "Rect1>Rect2" << endl;
_getch();
return 0;
}
| 2112110124 | Example34/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 234 |
#include"Rectangle.h"
Rectangle::Rectangle() :width(3), height(10){
}
Rectangle::Rectangle(double width, double height){
this->width = width;
this->height = height;
}
Rectangle::Rectangle(const Rectangle & rect){
this->width = rect.getWidth();
this->height = rect.getHeight();
}
Rectangle::~Rectangle(){... | 2112110124 | Example34/Rectangle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 733 |
// <=
#include<iostream>
#include<cmath>
using namespace std;
class Rectangle{
private:
double width;
double height;
public:
Rectangle();
Rectangle(double width, double height);
Rectangle(const Rectangle & rect);
~Rectangle();
double getArea() const;
double getWidth() const;
void setWidth(double... | 2112110124 | Example34/Rectangle.h | C | Microsoft Reciprocal License (Ms-RL) | 438 |
#include "khaibao.h"
#include <conio.h>
int main(){
Item i;
i.setData(120);
i.printData();
_getch();
return 0;
} | 2112110124 | Example39/caidat.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 127 |
//CONST
#include <iostream>
using namespace std;
class Item{
int data;
public:
void setData(int value){
data = value;
}
int getData() const{
return data;
}
void printData(){
cout << data;
}
};
| 2112110124 | Example39/khaibao.h | C | Microsoft Reciprocal License (Ms-RL) | 224 |
//CONST
#include <iostream>
using namespace std;
class Item{
int data;
public:
void setData(int value){
data = value;
}
int getData() const{
return data;
}
void printData(){
cout << data;
}
}; | 2112110124 | Example40/khaibao.h | C | Microsoft Reciprocal License (Ms-RL) | 222 |
#include "khaibao.h"
#include <conio.h>
int main(){
//const Item i; hang khong the doi gia tri
//i.setData(120);
//i.printData();
Item i;
int x = i.getData();
cout << x;
_getch();
return 0;
} | 2112110124 | Example40/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 212 |
//NAMESPACE
#include <iostream>
using namespace std;
namespace first_space{
void func(){
cout << "Inside first_space" << endl;
}
}
namespace secons_space{
void func(){
cout << "Inside second_space" << endl;
}
} | 2112110124 | Example41/khaibao.h | C | Microsoft Reciprocal License (Ms-RL) | 232 |
#include "khaibao.h"
#include <conio.h>
int main(){
first_space::func();
secons_space::func();
_getch();
return 0;
} | 2112110124 | Example41/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 129 |
//NAMESPACE
#include <iostream>
using namespace std;
namespace first_space{
void func(){
cout << "Inside first_space" << endl;
}
}
namespace secons_space{
void func(){
cout << "Inside second_space" << endl;
}
} | 2112110124 | Example42/khaibao.h | C | Microsoft Reciprocal License (Ms-RL) | 232 |
#include "khaibao.h"
#include <conio.h>
using namespace first_space;
int main(){
func();
_getch();
return 0;
} | 2112110124 | Example42/main.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 122 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example43
{
class Rectangle {
int x;
int y;
public void setValues(int a, int b) {
x = a;
y = b;
}
public int area() {
return (x... | 2112110124 | Example43/Program.cs | C# | Microsoft Reciprocal License (Ms-RL) | 735 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 2112110124 | Example43/Properties/AssemblyInfo.cs | C# | Microsoft Reciprocal License (Ms-RL) | 1,430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example44
{
//POINTERS TO CLASSES
class Rectangle {
int width;
int height;
public Rectangle(int a, int b) {
width = a;
height = b;
}
pu... | 2112110124 | Example44/Program.cs | C# | Microsoft Reciprocal License (Ms-RL) | 719 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 2112110124 | Example44/Properties/AssemblyInfo.cs | C# | Microsoft Reciprocal License (Ms-RL) | 1,430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example45
{
//Inheritance
class Polygon {
protected int width;
protected int height;
public void setValues(int a, int b) {
width = a;
height = b;
... | 2112110124 | Example45/Program.cs | C# | Microsoft Reciprocal License (Ms-RL) | 971 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 2112110124 | Example45/Properties/AssemblyInfo.cs | C# | Microsoft Reciprocal License (Ms-RL) | 1,430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example46
{
//CONSTRUCTOR
class CRectangle {
int width;
int height;
public CRectangle(int a, int b) {
width = a;
height = b;
}
public i... | 2112110124 | Example46/Program.cs | C# | Microsoft Reciprocal License (Ms-RL) | 718 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 2112110124 | Example46/Properties/AssemblyInfo.cs | C# | Microsoft Reciprocal License (Ms-RL) | 1,430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example47
{
//OVERLOADING CONSTRUCTOR
class CRectangle {
int width;
int height;
public CRectangle() {
width = 5;
height = 5;
}
public ... | 2112110124 | Example47/Program.cs | C# | Microsoft Reciprocal License (Ms-RL) | 818 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 2112110124 | Example47/Properties/AssemblyInfo.cs | C# | Microsoft Reciprocal License (Ms-RL) | 1,430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example48
{
class Polygon
{
protected int width;
protected int height;
public Polygon(int a) {
width = a;
}
public void setValues(int a, int b) {
... | 2112110124 | Example48/Polygon.cs | C# | Microsoft Reciprocal License (Ms-RL) | 391 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example48
{
//INHERITANCE AND CONSTRUCTOR
class Program
{
static void Main(string[] args)
{
Rectangle rect = new Rectangle(8, 9);
Console.WriteLine("rect a:{... | 2112110124 | Example48/Program.cs | C# | Microsoft Reciprocal License (Ms-RL) | 373 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 2112110124 | Example48/Properties/AssemblyInfo.cs | C# | Microsoft Reciprocal License (Ms-RL) | 1,430 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Example48
{
class Rectangle:Polygon
{
public Rectangle(int w, int h) : base(w) {
height = h;
}
public int area() {
return (width * height);
}
... | 2112110124 | Example48/Rectangle.cs | C# | Microsoft Reciprocal License (Ms-RL) | 331 |
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
class Circle{
private:
double radius;
string color;
public:
Circle(double r = 1.0, string c = "red"){
radius = r;
color = c;
}
double getRadius(){
return radius;
}
string getColor(){
return color;
}
d... | 2112110124 | Example49/Circle.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 834 |
#include <iostream>
#include "Time.h"
#include <conio.h>
using namespace std;
int main() {
Time t1(23, 59, 59);
t1.print();
t1.setHour(12);
t1.setMinute(30);
t1.setSecond(15);
t1.print();
cout << "Hour is " << t1.getHour() << endl;
cout << "Minute is " << t1.getMinute() << endl;
cout << "Secon... | 2112110124 | Example50/TestTime.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 589 |
#include <iostream>
#include <iomanip>
#include "Time.h"
using namespace std;
Time::Time(int h, int m, int s){
hour = h;
minute = m;
second = s;
}
int Time::getHour() const{
return hour;
}
void Time::setHour(int h){
hour = h;
}
int Time::getMinute() const{
return minute;
}
void Time::setMi... | 2112110124 | Example50/Time.cpp | C++ | Microsoft Reciprocal License (Ms-RL) | 860 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.