$sel_day="SELECT * FROM menu WHERE dayname='".$cc."'";
$get_day=mysqli_query($con,$sel_day) or die(mysqli_error($con));
while($row_d = mysqli_fetch_array($get_day)){
echo "<input type='hidden' name='daycode' value='".$row_d['cod']."'>";
$cd=$row_d['cod'];}
if(isset($cd)==True){
#get(day) відкривається
$newDate = date("d-m-Y", strtotime($cc));
echo "<h2><label>".$newDate ."</label></h2>";
?>
if($count>=1){
$up_query="UPDATE planning SET worker='".$usercode."', datte='".$cn."', first='".$in_sup."', second='".$in_second."', second_plus='".$in_second_plus."', salad='".$in_salad."', drink='".$in_drink."', dessert='".$in_dessert."', bread='".$in_bread."' WHERE worker='".$usercode."' AND datte='".$cn."'";
$up=mysqli_query($con,$up_query) or die(mysqli_error($con));
echo '<script type="text/javascript">
window.open("https://localhost/kitchen/login1.php","_self");
</script>';
}else{
$add_query="INSERT INTO planning (worker, datte, first,second, second_plus,salad,drink,drink2,dessert,dessert2,bread) VALUES ('$usercode','$cn','$in_sup','$in_second','$in_second_plus','$in_salad','$in_drink','$in_drink2','$in_dessert','$in_dessert2','$in_bread')";
$sa=mysqli_query($con,$add_query) or die(mysqli_error($con));
echo '<script type="text/javascript">
window.open("https://localhost/kitchen/login1.php","_self");
</script>';
}
}
}
else{
echo '<script>alert("Невірна дата")
window.location.href="login1.php";
</script>';
}
<?php
if(isset($_POST['sett']))
{
$in_sup=$_POST['sup'];
$cd=$_POST['day'];
$in_second=$_POST['garnir'];
$in_second_plus=$_POST['garnir2'];
$in_salad=$_POST['salat'];
$in_drink=$_POST['drink'];
$in_drink2=$_POST['drink2'];
$in_bread=$_POST['bread'];
$in_dessert=$_POST['dessert'];
$in_dessert2=$_POST['dessert2'];
$cn=$_POST['daycode'];
$check_usr="SELECT * FROM planning WHERE worker='$usercode' and datte='$cn'";
$result=mysqli_query($con,$check_usr) or die(mysqli_error($con));
$count=mysqli_num_rows($result);
if($count>=1){
$up_query="UPDATE planning SET worker='".$usercode."', datte='".$cn."', first='".$in_sup."', second='".$in_second."', second_plus='".$in_second_plus."', salad='".$in_salad."', drink='".$in_drink."', dessert='".$in_dessert."', bread='".$in_bread."' WHERE worker='".$usercode."' AND datte='".$cn."'";
$up=mysqli_query($con,$up_query) or die(mysqli_error($con));
echo '<script type="text/javascript">
window.open("https://localhost/kitchen/login1.php","_self");
</script>';
}else{
$add_query="INSERT INTO planning (worker, datte, first,second, second_plus,salad,drink,drink2,dessert,dessert2,bread) VALUES ('$usercode','$cn','$in_sup','$in_second','$in_second_plus','$in_salad','$in_drink','$in_drink2','$in_dessert','$in_dessert2','$in_bread')";
$sa=mysqli_query($con,$add_query) or die(mysqli_error($con));
echo '<script type="text/javascript">
window.open("https://localhost/kitchen/login1.php","_self");
</script>';
}
}
}
else{
echo '<script>alert("Невірна дата")
window.location.href="login1.php";
</script>';
}
?>
#include <cstdio>
#include <cstring>
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
void Karatsuba( int n, int *c, int *a, int *b )
{
if (n <= 8)
{
forn(i, 2 * n)
c[i] = 0;
forn(i, n)
forn(j, n)
c[i + j] += a[i] * b[j];
return;
}
int k = n / 2;
int *f = new int[n];
int *a12 = new int[k];
int *b12 = new int[k];
Karatsuba(k, c, a, b);
Karatsuba(k, c + n, a + k, b + k);
forn(i, k)
{
a12[i] = a[i] + a[i + k];
b12[i] = b[i] + b[i + k];
}
Karatsuba(k, f, a12, b12);
forn(i, n)
f[i] -= c[i] + c[i + n];
forn(i, n)
c[i + k] += f[i];
}
const int N = 20;
int a[N], b[N], c[2 * N];
void read( int *a )
{
static char s[N + 1];
gets(s);
int k = 0;
for (int i = strlen(s) - 1; i >= 0; i--)
a[k++] = s[i] - '0';
}
void out( int n, int *a ){
forn(i, n)
printf("%d", a[n - i - 1]);
}
int main(){
read(a);
read(b);
Karatsuba(N, c, a, b);
forn(i, 2*N)
if (c[i] >= 10)
c[i + 1] += c[i] / 10, c[i] %= 10;
out(2 * N, c);
}
#include<vector>
#include<iostream>
using namespace std;
class Matrix
{
private:
vector<vector<int>> Mat;
Matrix() {};
public:
Matrix(vector<vector<int>> mat) : Mat(mat) {};//Конструктор
~Matrix() {};
Matrix(const Matrix &rhs);
int getnum(int r, int c)const
{
return Mat[r][c];
};
int getrow()const
{
return (Mat.size());
};
int getcol()const
{
return (Mat[0].size());
};
//операторы
friend ostream & operator<<(ostream &os, const Matrix &rhs);
Matrix Matrix::operator+(const Matrix &rhs);
Matrix &operator=(const Matrix &rhs);
//Matrix &operator*(const Matrix &lhs, const Matrix &rhs);
//Matrix &operator*(const Matrix &lhs, const vector<int> &rhs);
};
ostream &operator<<(ostream &os, const Matrix &rhs)
{
for (int i=0; i < rhs.getrow(); ++i)
{
for (int j=0; j < rhs.getcol(); ++j)
os << rhs.getnum(i, j) << '\t';
os << endl;
}
return os;
}
Matrix Matrix::operator+(const Matrix &rhs)
{
vector<vector<int>> temp(getrow(), vector<int>(getcol(), 0));
Matrix Temp(temp);
if ((getrow() != rhs.getrow()) || (getcol() != rhs.getcol()))
{
cout << "Размеры матриц не совпадают." << endl;
system("pause");
exit(1);
}
for (unsigned int i=0; i < Temp.getrow(); i++)
for (unsigned int j=0; j < Temp.getcol(); j++)
Temp.Mat[i][j] = getnum(i, j) + rhs.getnum(i, j);
return Temp;
}
Matrix &Matrix::operator=(const Matrix &rhs)
{
cout << rhs.getrow() << endl;
this->Mat.resize(rhs.getrow());
for (int i=0; i < this->getrow(); ++i)
this->Mat[i].resize(rhs.getcol());
for (int i(0); i < this->getrow(); ++i)
for (int j=0; j < this->getcol(); ++j)
this->Mat[i][j] = rhs.Mat[i][j];
return *this;
}
Matrix::Matrix(const Matrix &rhs)
{
Mat = rhs.Mat;
}
int main()
{
setlocale(LC_ALL, "rus");
int n, n1;
cin >> n >> n1;
vector<vector<int>> A(n, vector<int>(n1, 0));
vector<vector<int>> B(n, vector<int>(n1, 0));
vector<vector<int>> C(1,vector<int>(1, 0));
for (int i=0; i <n1; ++i)
for (int j=0; j <n; ++j)
{
A[i][j] = i;
B[j][i] = i;
}
Matrix test(A);
Matrix test2(B);
Matrix test3(C);//сложение
/*
Matrix test4(D);//умножение матриц
Matrix test5(E);//умножение матрицы на вектор
*/
cout << "Первая матрица:" << endl << test << " " << endl;
cout << "Вторая матрица:" << endl << test2 << " " << endl;
test3 = test + test2;
cout<<"Сложение 1 и 2:"<<endl << test3;
system("pause");
return 0;
}