乘法通過查表實現

2021-07-04 08:02:29 字數 1306 閱讀 4388

本文主要通過小學學的99乘法表實現

// 乘法原始實現.cpp : 定義控制台應用程式的入口點。

//#include "stdafx.h"

#include

#include

#include

using namespace std;

int array_result[10][10]=,,,

,,,,

,,};int getcount(int num)

return i;

};void get_int_to_char(int*k,int n,int num)

};void multiply_int(int a,int b)

int a_count=getcount(a);

int b_count=getcount(b);

int* a_int=new int[a_count];

int* b_int=new int[b_count];

get_int_to_char(a_int,a_count,a);//得到整數陣列形式陣列低位(0)存放整數的最高位,高位存放整數的最低位

get_int_to_char(b_int,b_count,b);

list> all;

int jinwei=0;//進製

int count=b_count+a_count-1;//相乘後先假設其是位數最小的情況

for(int i=b_count-1;i>=0;i--)

} else

}jinwei=0;

all.push_back(unit);    

}int*sum=new int[count];

for(int i=0;i sum[i]=0; 

}auto ib=all.begin();

auto ie=all.end();

//在sum陣列的偏移位置

int index=0;//例如234*546  根據上面得到的 鍊錶234*6結果的陣列表達形式—鍊錶234*4結果的陣列表達形式—鍊錶234*5結果的陣列表達形式

jinwei=0;

for(;ib!=ie;ib++)

else

} index++;

}for(int i=0;icout<}

delete sum;

sum=nullptr;

delete a_int;

a_int=nullptr;

delete b_int;

b_int=nullptr;

}int _tmain(int argc, _tchar* argv)

通過binlog日誌查表資料缺少原因

在做乙個ecstore專案的時候 同事修改了一些東西 等到拉下來 什麼時候cmd update後 什麼時候再登會員登不上了 許可權不正確 修改完新密碼 一看這塊兒 sdb b2c members 表getlist不到資料導致的 再看表裡確實沒有我這個會員的資料了 sdb pam members表裡是...

ORACLE 通過指定條件查表名(11g)

通過字段查詢表 select table name from user tab columns where column name name 通過索引名查詢表名和相應的欄位名 select index name,table name,column name from dba ind columns ...

矩陣乘法 矩陣乘法的基本實現

求解關於兩個矩陣的乘積 參考線性代數裡面的兩個矩陣相乘的規則,我這裡不再贅述,詳情附上了乙個鏈結,我的程式設計也是用了裡面的例子 這裡寫鏈結內容 具體的過程我會在 片裡面加上注釋 矩陣乘法 author seen 2015 09 18 include using namespace std int ...