uses graphABC;
begin
setwindowsize(600,500);
setbrushcolor(clGray);
Ellipse(320,30,490,400);
Ellipse(120,30,300,400);
setbrushcolor(clMintCream);
Ellipse(335,40,480,380);
Ellipse(140,40,280,380);
setbrushcolor(clGray);
Ellipse(100,430,500,130);
setbrushcolor(clNavy);
Ellipse(250,240,200,310);
Ellipse(350,240,400,310);
setbrushcolor(clwhite);
Ellipse(240,270,220,300);
Ellipse(360,270,380,300);
setbrushcolor(clblack);
Ellipse(270,330,330,370);
line(300,370,300,400);
Arc(300,280,120,220,-40);
line(50,350,200,350);
line(30,340,190,340);
line(10,330,180,330);
line(410,330,570,330);
line(400,340,560,340);
line(390,350,550,350);
line(240,230,220,150);
line(230,230,180,80);
line(220,230,180,150);
line(360,230,380,150);
line(370,230,430,80);
line(380,230,430,150);
end.
//Задача 3
#include <iostream>
#include <stdio.h>
using namespace std;
string SubString(string str, int startIndex, int endIndex)
{
string output = "";
for (int i = startIndex; i < endIndex; i++)
output += str[i];
return output;
}
string ToString(int num)
{
string output = "";
char symbol = 0;
int tmp = num;
while(num != 0)
{
tmp = num % 10;
num /= 10;
symbol = (char)(tmp + 48);
output = symbol + output;
}
return output;
}
int IndexOf(string str, char symbol)
{
int index = -1;
for (int i = 0; i < str.length(); i++)
{
if (str[i] == symbol)
{
index = i;
break;
}
}
return index;
}
bool Contains(string text, char symbol)
{
for (int i = 0; i < text.length(); i++)
{
if (text[i] == symbol)
return true;
}
return false;
}
bool IsRepeat(string values, string num)
{
string tmp = "";
while (IndexOf(values, ' ') != -1)
{
values = SubString(values, IndexOf(values, ' ') + 1, values.length() + 1);
tmp = SubString(values, 0, IndexOf(values, ' '));
if (tmp == num)
return true;
}
return false;
}
int main()
{
const int arrSize = 10;
int arr[arrSize] = { 10, 22, 10, 76, 44, 22, 22, 12, 9, 76};
string values = "";
bool couples = false;
for (int i = 0; i < arrSize; i++)
{
string str = ToString(arr[i]);
for (int j = i + 1; j < arrSize; j++)
{
if (arr[i] == arr[j] && !IsRepeat(values, ToString(arr[j])))
{
str += " " + ToString(arr[j]);
values += " " + ToString(arr[j]);
}
}
if (Contains(str, ' '))
{
couples = true;
cout << "Couple: " << str << endl;
}
}
if (!couples)
cout << "Couple not detected!" << endl;
return 0;
}
--------------------------------------------------------------------------
//Задача 5
#include <iostream>
using namespace std;
string ToLower(string text)
{
string output = "";
for (int i = 0; i < text.length(); i++)
output += tolower(text[i]);
return output;
}
int main()
{
string str1 = "";
string str2 = "";
cout << "Enter first string: ";
getline(cin, str1);
cout << "Enter second string: ";
getline(cin, str2);
if (ToLower(str1) == ToLower(str2))
cout << endl << "Strings are equal" << endl;
else
cout << endl << "Strings are not equal" << endl;
return 0;
}
ответ:Ориентация
Объяснение:
Проверенно