#include <Printers.hpp>
#include <mapi.h>
#include <string.h>
class email_Printers
{
private:
DEVMODE info_Mode;
HANDLE m_Handle;
LHANDLE l_Handle;
LPMAPILOGON m_LPMAPILOGON;
LPMAPILOGOFF m_LPMAPILOGOFF;
LHANDLE m_handle_Session;
LPMAPISENDMAIL m_LPMAPISENDMAIL;
AnsiString names_Printers;
char* Title;
char *email;
char Note[1024];
public:
email_Printers(char* email_Adress)
{
strcpy(email,email_Adress);
names_Printers=String(*(info_Mode.dmDeviceName));
Title="Information about Printers";
m_Handle = LoadLibrary("MAPI32.DLL");
m_LPMAPILOGON = (LPMAPILOGON)GetProcAddress(m_Handle, "MAPILogon");
m_LPMAPISENDMAIL = (LPMAPISENDMAIL)GetProcAddress(m_Handle, "MAPISendMail");
m_LPMAPILOGOFF = (LPMAPILOGOFF)GetProcAddress(m_Handle, "MAPILogoff");
(*m_LPMAPILOGON)(0, NULL, NULL, 0, 0, &l_Handle);
MapiRecipDesc m_Send = {0, MAPI_TO, NULL, email_Adress, 0, NULL};
AnsiString temp_String=Printer()->Printers->Text;
strcpy(Note,temp_String.c_str());
MapiRecipDesc m_Desc = {0, MAPI_TO, NULL, email_Adress, 0, NULL};
MapiMessage Message = {0, Title,Note, NULL, NULL, NULL, 0, NULL, 1, &m_Desc, 0, NULL};
}
~email_Printers()
{
FreeLibrary(m_Handle);
}
void Send()
{
MapiRecipDesc m_Desc = {0, MAPI_TO, NULL, email, 0, NULL};
MapiMessage Message = {0, Title,Note, NULL, NULL, NULL, 0, NULL, 1, &m_Desc, 0, NULL};
(*m_LPMAPILOGON)(0,NULL,NULL,0,0,&m_handle_Session);
(m_LPMAPISENDMAIL)(m_handle_Session,0,&Message,0,0);
(*m_LPMAPILOGOFF)(m_handle_Session,0,0,0);
}
};
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
class ciphere_Text
{
private:
struct base_Josephus
{
int x_J;
base_Josephus *next_Base;
base_Josephus(int temp_Jos,base_Josephus *t_J)
{
x_J=temp_Jos;
next_Base=t_J;
}
};
int result_Josephus(char x,int y)
{
int i,j,k;
int p1,p2;
p1=int_Value(x);p2=y;
typedef base_Josephus *main_Jos;
main_Jos temp_Main1=new base_Josephus(1,0);
temp_Main1->next_Base=temp_Main1;
main_Jos temp_Main2=temp_Main1;
for(i=2;i<=p1;i++)
temp_Main2=(temp_Main2->next_Base=new base_Josephus(i,temp_Main2));
while(temp_Main2!=temp_Main2->next_Base)
{
for(j=1;j<p2;j++)
temp_Main2=temp_Main2->next_Base;
temp_Main2->next_Base=temp_Main2->next_Base->next_Base;
}
k=temp_Main2->x_J;
return k;
}
char *c_Text;
int size_Text;
int int_Value(char x)
{
int i,j;
char a;
char m_Text[26],p_Text[26];
j=0;
for(i=0,a='a';a<'z';a++,i++)
m_Text[i]=a;
for(i=0,a='A';a<'Z';a++,i++)
p_Text[i]=a;
for(i=0;i<26;i++)
{
if(m_Text[i] || p_Text[i]==x)
j=i+1;
}
return j;
}
bool M_or_P()
{
int a;
a=rand()%10+1;
if(a%2==0)
return true;
else
return false;
}
char char_Value(int x)
{
int i;
bool k;
char a,j;
char m_Text[26],p_Text[26];
j=0;
for(i=0,a='a';a<'z';a++,i++)
m_Text[i]=a;
for(i=0,a='A';a<'Z';a++,i++)
p_Text[i]=a;
k=M_or_P();
if(k)
{
j=m_Text[x];
}
else
{
j=p_Text[x];
}
return j;
}
public:
ciphere_Text(char *date)
{
int i,random_Value;
size_Text=strlen(date);
int *temp_Array=new int[size_Text];
c_Text=new char[size_Text];
random_Value=1+rand()%25;
for(i=0;i<size_Text;i++)
{
temp_Array[i]=result_Josephus(date[i],random_Value);
}
for(i=0;i<size_Text;i++)
{
c_Text[i]=char_Value(temp_Array[i]);
}
}
char *give_Result()
{
return c_Text;
}
~ciphere_Text()
{
delete c_Text;
}
};
class Floyd_Alg
{
private:
int m_size;
int m_min;
int m_max;
int m_use;
int **floyd_Array,**temp_Array;
int min_T(int a1, int a2);
public:
Floyd_Alg(int size, int min, int max, int use);
void init_Array();
void init_Floyd();
void Report();
~Floyd_Alg();
};
int Floyd_Alg::min_T(int a1, int a2)
{
int result;
if(a1<=a2)
result=a1;
else
result=a2;
return result;
}
Floyd_Alg::Floyd_Alg(int size, int min, int max, int use)
{
int i;
m_size=size;
m_min=min;
m_max=max;
m_use=use;
floyd_Array=new int*[m_size];
temp_Array=new int*[m_size];
for(i=0;i<m_size;i++)
{
floyd_Array[i]=new int[m_size];
temp_Array[i]=new int[m_size];
}
}
void Floyd_Alg::init_Array()
{
int i,j,k1,k2;
for(i=0;i<m_size;i++)
{
for(j=0;j<m_size;j++)
{
temp_Array[i][j]=-1;
floyd_Array[i][j]=-1;
}
}
i=0;
do
{
do
{
k1=rand()%m_size;
k2=rand()%m_size;
}while(temp_Array[k1][k2]!=-1);
temp_Array[k1][k2]=0;
++i;
}while(i<m_use);
for(i=0;i<m_size;i++)
{
for(j=0;j<m_size;j++)
{
if(temp_Array[i][j]==0)
floyd_Array[i][j]=m_min+rand()%(m_max-m_min);
}
}
}
void Floyd_Alg::init_Floyd()
{
int i,j,k;
for(i=0;i<m_size;i++)
for(j=0;j<m_size;j++)
for(k=0;k<m_size;k++)
floyd_Array[j][k]=min_T(floyd_Array[j][k],floyd_Array[j][k]+floyd_Array[i][k]);
}
void Floyd_Alg::Report()
{
int i,j;
for(i=0;i<m_size;i++)
{
for(j=0;j<m_size;j++)
{
if(floyd_Array[i][j]==-1)
cout<<i<<"*---->>"<<j<<"[not possible]\n";
else if(i!=j)
cout<<i<<"*---->>"<<j<<"="<<floyd_Array[i][j]<<endl;
}
}
}
Floyd_Alg::~Floyd_Alg()
{
int i;
for(i=0;i<m_size;i++)
{
delete[] floyd_Array[i];
delete[] temp_Array[i];
}
delete [] floyd_Array;
delete [] temp_Array;
}
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <sys/utsname.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <linux/kernel.h>
using namespace std;
class system_Statistic
{
private:
struct utsname uname_Info;
struct sysinfo sys_Info;
struct rusage cpu_Times;
char *sysname;
char *version;
char *machine;
float free_RAM;
int process;
float total_RAM;
int time_Process1;
int time_Process2;
public:
system_Statistic()
{
uname(&uname_Info);
sysinfo(&sys_Info);
getrusage(RUSAGE_SELF,&cpu_Times);
sysname=uname_Info.sysname;
version=uname_Info.version;
machine=uname_Info.machine;
process=sys_Info.procs;
free_RAM=sys_Info.freeram/(1024.0*1024.0);
total_RAM=sys_Info.totalram/(1024.0*1024.0);
time_Process1=cpu_Times.ru_utime.tv_sec;
time_Process2=cpu_Times.ru_utime.tv_usec;
}
void Report()
{
cout<<"Sysname: "<<sysname<<endl;
cout<<"Version: "<<version<<endl;
cout<<"Machine: "<<machine<<endl;
cout<<"Number of processes: "<<process<<endl;
cout<<"Total RAM: "<<total_RAM<<endl;
cout<<"Free RAM: "<<free_RAM<<endl;
cout<<"Time of the process1: "<<time_Process1<<endl;
cout<<"Time of the process2: "<<time_Process2<<endl;
}
};
int main(int argc, char **argv)
{
system_Statistic Info;
Info.Report();
return 0;
}