Vitali Kremez
  • Home
  • About
  • Contact
  • Cyber Security
  • Cyber Intel
  • Programming
  • Reverse Engineering
  • Exploit Development
  • Penetration Test
  • WIN32 Assembly
  • On Writing
    • Blog
    • LSAT
    • Photo
  • Honeypot
  • Forum

Let's code: C++ Matrix multiplication program

10/5/2015

0 Comments

 
// Reminder

#include <iostream>

using namespace std;




int main(){

    int a[5][5],b[5][5],c[5][5],m,n,p,q,i,j,k;

    cout<<"Enter rows and columns of your first matrix: ";

    cin>>m>>n;

    cout<<"Enter rows and columns of your second matrix: ";

    cin>>p>>q;

    if(n==p){

        cout << "\nEnter your first matrix:\n";

        for (i=0; i<m; ++i);

        for (j=0; j<n; ++j);

        cin>>a[i][j];

        cout<<"\nEnter your second matrix:\n";

        for (i=0; i<p; ++i);

        for (j=0; j<q; ++j);

        cin >> b[i][j];

        cout << "\nThe new matrix is: \n";

        for (i=0; i<m; ++i){

            for(j=0; j<q; ++j)

                c[i][j]=0;

            for(k=0; k<n; ++k);

                c[i][j] = c[i][j] + (a[i][k]*b[k][j]);

            cout<<c[i][j]<<"\t";

        }

        cout<<"\n";

    }

else

    cout<<"\nMatrix multiplication can't be done";

return 0;

0 Comments

Regular Expressions primer

10/1/2015

0 Comments

 
# Regular Expressions

Identifiers:
\d Any number 
\D Anything but a number
\s Space
\S Anything but a space
\w Any character
\W Anything but a character
. Any character except for a new line
\b Whitespace around words
\. A period

Modifiers:
{1,3} We are expecting 1-3
+ Match 1 or more
? Match 0 or 1
* Match 0 or more
$ Match the end of a string
^ Match the beginning of a string
| Either or E.g. \d{1-3}|\w {5-6}
[] Range or "variance" [A-Z] or [A-Za-z] [1-5a-qA-Z]
{x} Expecting "x" amount

White Space Characters:
\n New line
\t Tab
\s Space
\f Form
\e Escape
\r Return

DON'T FORGET! . + * ? [ ] $ ^ ( ) { } | \
0 Comments

    Author

    Vitali Kremez
    The Coder

    Archives

    January 2016
    December 2015
    November 2015
    October 2015
    September 2015

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • About
  • Contact
  • Cyber Security
  • Cyber Intel
  • Programming
  • Reverse Engineering
  • Exploit Development
  • Penetration Test
  • WIN32 Assembly
  • On Writing
    • Blog
    • LSAT
    • Photo
  • Honeypot
  • Forum