Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int size = 3;
- int matrix1[3][3] = {
- { 1, 2, 3 },
- { 4, 5, 6 },
- { 7, 8, 9 }
- };
- int matrix2[3][3] = {
- { 1, 2, 3 },
- { 4, 5, 6 },
- { 7, 8, 9 }
- };
- void multiply(int* matrix1, int* matrix2)
- {
- int result[size][size];
- for (int i = 0; i < size; ++i)
- {
- for (int j = 0; j < size; j++)
- {
- result[i][j] = 0;
- for (int k = 0; k < size; k++)
- {
- result[i][j] += matrix1[i * size + k] * matrix2[k * size + j];
- }
- }
- }
- for (int i = 0; i < size; i++)
- {
- for (int j = 0; j < size; j++)
- {
- cout << result[i][j] << " ";
- }
- cout << endl;
- }
- }
- double computeLength(double x1, double x2, double y1, double y2)
- {
- return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
- }
- bool isTriangle(double a, double b, double c)
- {
- if ((a + b) > c && a + c > b && b + c > a)
- return true;
- else return false;
- }
- int readarray(int* array)
- {
- int size;
- cin >> size;
- for (int i = 0; i < size; ++i)
- cin >> array[i];
- return size;
- }
- void writearray(int* array, int size)
- {
- for (int i = 0; i < size; i++)
- cout << array[i]<<" ";
- }
- void strcat(char* destination, char* source)
- {
- int destinationLength = 0;
- while (destination[destinationLength] != '\0')
- {
- destinationLength++;
- }
- int sourceLength = 0;
- while (source[sourceLength] != '\0')
- {
- destination[destinationLength] = source[sourceLength];
- destinationLength++;
- sourceLength++;
- }
- destination[destinationLength] = '\0';
- }
- int main(int argc, char** argv)
- {
- char text[1000000] = "tova e text";
- char* toAppend = "appendme";
- for (int i = 0; i < 100000; i++)
- {
- strcat(text, toAppend);
- }
- cout << text << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement