, , , , , . .

 

 

!

 

:

:

 

 

 

?

StudentHelp, , MS Word. , , antiplagiat.ru, etxt.ru advego.ru. StudentHelp , Word .


:


UML-

:

: . : 21.08.2012. : 2011. : 7. antiplagiat.ru: < 30%

():


̲ͲΠ ² Ƞ
. .. 


603


2
'-

.603.621.10.050103.106342.01





621
..
______________________________

603
. .
______________________________







2010
. , , a, b x - , , N. . , , . h, cpp. , .
UML-


:
Headers.h:
#pragma once
#include "tchar.h"
#include <stdio.h>
#include <iostream>
#include "windows.h"
#include <fstream>
#include <conio.h>
#include <math.h>
using namespace std;
Class.h:
#pragma once
#include "Headers.h"

class ClassArray
{

int * iArray;
char Name;
public :
int SizeArray;
ClassArray(int size, char nName);
~ClassArray();
void InputValue (char Array);
void OutputValue(ClassArray &X);
double Mean();
int operator>( ClassArray & right);
int operator<(ClassArray & right);
int operator==(ClassArray & right);
ClassArray& operator=(ClassArray & right);
ClassArray& operator=(const int right);
ClassArray& operator/(const ClassArray &right);
ClassArray& operator-(const int right);
ClassArray& operator-(const ClassArray &right);
ClassArray& operator+(const int right);
};
Class.cpp:
#include "Class.h"
#include "Headers.h"

char * ArraySizeErr = " !";
char * ZeroErr = " !";


ClassArray ::ClassArray(int size, char nName)
{
Name = nName;
SizeArray = size;
iArray = new int[size];
}


ClassArray ::~ClassArray()
{
delete[] iArray;
}

void ClassArray :: InputValue (char Array)
{
int var;
for(int x =0; x < SizeArray; x++)
{
int i = 1;
do
{
ifstream my_inp("CON");
cout << " " << x+ 1 <<" "<< Array <<": ";
my_inp >> var;
if(my_inp.rdstate() == ios::badbit|| my_inp.rdstate() == ios::failbit)
{
cout << " !... \n";
i = 1;
}
else
i = 0;
}
while(i);
iArray[x] = var;
}

}

void ClassArray::OutputValue(ClassArray &X)
{
for(int x = 0; x < X.SizeArray; x++)
cout <<"X["<<x<<"] = "<< X.iArray[x] << "\t";
}

double ClassArray :: Mean()
{
double Mean = 0;
for(int x = 0 ; x < SizeArray; x++)
Mean += iArray[x];
Mean /= SizeArray;
return Mean;
}


int ClassArray :: operator>(ClassArray & right)
{
return (this->Mean() > right.Mean());
}

int ClassArray :: operator<( ClassArray & right)
{
return (this->Mean() < right.Mean());
}

int ClassArray :: operator==( ClassArray & right)
{
return this->Mean() == right.Mean();
}

ClassArray& ClassArray ::operator=(ClassArray & right)
{
if(this->SizeArray != right.SizeArray)
{
if(SizeArray != 0)
delete[] iArray;
SizeArray = right.SizeArray;
iArray = new int[SizeArray];
}
for(int x = 0; x < SizeArray; x++)
iArray[x] = right.iArray[x];
return *this;
}

ClassArray& ClassArray :: operator/(const ClassArray &right)
{
if(this->SizeArray != right.SizeArray)
throw ArraySizeErr;
for(int x = 0; x < SizeArray; x++)
{
if(right.iArray[x] == 0)
throw ZeroErr;
iArray[x] = iArray[x] / right.iArray[x];
}
return *this;
}

ClassArray& ClassArray ::operator=(const int right)
{
for(int x = 0; x< this->SizeArray; x++)
this->iArray[x] = right;
return *this;
}

ClassArray& ClassArray ::operator+(const int right)
{
for(int x = 0; x < SizeArray; x++)
iArray[x] = iArray[x] + right;
return *this;
}

ClassArray& ClassArray ::operator-(const int right)
{
for(int x = 0; x < SizeArray; x++)
iArray[x] = iArray[x] - right;
return *this;
}

ClassArray& ClassArray ::operator-(const ClassArray &right)
{
for(int x = 0; x < SizeArray; x++)
iArray[x] = iArray[x] - right.iArray[x];
return *this;
}
Main.cpp:
#include "Headers.h"
#include "Class.h"

int InputSize ()
{
int i = 1;
int Size;
while(i)
{
ifstream my_inp("CON");
cout << " (1 - 10): ";
my_inp >> Size;
if(my_inp.rdstate() == ios ::badbit || my_inp.rdstate() == ios::failbit || Size > 10 || Size < 1)
{
cout << " ! ...\n";
i = 1;
}
else
i = 0;
}
return Size;
}



int _tmain(int argc, _TCHAR* argv[])
{

char key;
SetConsoleOutputCP(1251);
do{
try{
cout << "\t \t if(a>b) \t x = (a-b)/a+1" << endl;
cout << "\t \t if(a==b)\t x = 25" << endl;
cout << "\t \t if(a<b) \t x = (a-5)/b" << endl;
cout << "\n";
int Size = InputSize();
ClassArray a(Size, 'a');
ClassArray b(Size, 'b');
a.InputValue('a');
b.InputValue('b');
ClassArray X(Size, 'X');
if(a>b)
X = (a-b)/(a+1);
else if(a==b)
X = 25;
else if(a<b)
{
X = (a-5)/b;
}
X.OutputValue(X);
}
catch(char * e)
{
cout << e;
}
cout << "\n 'y' ! \n\n";
key = _getch();
}while(key == 'y');
return 0;
}

:
if(a>b) x = (a-b)/a+1
if(a==b) x = 25
if(a<b) x = (a-5)/b

(1 - 10): 1
1 a: 2
1 b: 1
X[0] = 1
'y' !

if(a>b) x = (a-b)/a+1
if(a==b) x = 25
if(a<b) x = (a-5)/b

(1 - 10): 1
1 a: 2
1 b: 2
X[0] = 25
'y' !
..................



90% antiplagiat.ru, etxt.ru advego.ru




* . , .