herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
GCD(10^10+1, 10^11+2)=?
-
輸出你的課表 含Java code以及結果
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
一、 試利用switch case由程式中直接輸入一個1~7 之間的整數day,代表星期一到星期日。若day 的值是1,則印出 "星期一",若day 的值是2,則印出 "星期二",若day 的值是7,則印出 "星期日",...
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
33, 45, 87, 99, 27 算平均
10 則留言:
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called..." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called..." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(double a[row][col]) is called..." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] =T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROYER......\n";
}
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called..." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called..." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T]) is called..." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << " DESTROYER...\n";
}
......
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called...." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROTER....\n";
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
cout << "----------------\n";
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j] = A(i, j) + B(i, j);
}
return C;
}
int main()
{
double a[3][3] = { { 1,2,3 },{ 4,5,6 },{ 7,8,9 } };
double b[3][3] = { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "....." << endl;
memset(term, 0, sizeof(term)); }
Matrix(double a[row][col]) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
~Matrix() {
cout << term[0][0] ;
cout << "DS" << endl;
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j]= A(i,j)+B(i,j);
}
return C;
}
int main()
{
double a[3][3]= {{1,2,3}, {4,5,6},{7,8,9} };
double b[3][3]= { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called...." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROTER....\n";
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
cout << "----------------\n";
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j] = A(i, j) + B(i, j);
}
return C;
}
int main()
{
double a[3][3] = { { 1,2,3 },{ 4,5,6 },{ 7,8,9 } };
double b[3][3] = { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "....." << endl;
memset(term, 0, sizeof(term)); }
Matrix(double a[row][col]) {
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
~Matrix() {
cout << term[0][0] ;
cout << "DS" << endl;
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j]= A(i,j)+B(i,j);
}
return C;
}
int main()
{
double a[3][3]= {{1,2,3}, {4,5,6},{7,8,9} };
double b[3][3]= { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called...." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROTER....\n";
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
cout << "----------------\n";
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j] = A(i, j) + B(i, j);
}
return C;
}
int main()
{
double a[3][3] = { { 1,2,3 },{ 4,5,6 },{ 7,8,9 } };
double b[3][3] = { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called...." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROTER....\n";
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
cout << "----------------\n";
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j] = A(i, j) + B(i, j);
}
return C;
}
int main()
{
double a[3][3] = { { 1,2,3 },{ 4,5,6 },{ 7,8,9 } };
double b[3][3] = { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called...." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROTER....\n";
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
cout << "----------------\n";
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j] = A(i, j) + B(i, j);
}
return C;
}
int main()
{
double a[3][3] = { { 1,2,3 },{ 4,5,6 },{ 7,8,9 } };
double b[3][3] = { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
#define row 3
#define col 3
class Matrix
{
public:
double term[row][col];
Matrix() {
cout << "Matrix() is called...." << endl;
memset(term, 0, sizeof(term));
}
Matrix(double a[row][col]) {
cout << "Matrix(double a[row][col]) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = a[i][j];
}
}
Matrix(const Matrix& T) {
cout << "Matrix(const Matrix& T) is called....." << endl;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
term[i][j] = T.term[i][j];
}
}
~Matrix() {
cout << term[0][0];
cout << "DESTROTER....\n";
}
double& operator()(int i, int j) {
return term[i][j];
}
void print() {
cout << "----------------\n";
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
cout << term[i][j] <<"\t";
}
cout << endl;
}
}
};
Matrix& operator+(Matrix A, Matrix B) {
Matrix C;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++)
C.term[i][j] = A(i, j) + B(i, j);
}
return C;
}
int main()
{
double a[3][3] = { { 1,2,3 },{ 4,5,6 },{ 7,8,9 } };
double b[3][3] = { { 4,5,6 },{ 7,8,9 },{ 1,2,3 } };
Matrix A(a), B(b);
A.print();
B.print();
Matrix C = A + B;
C.print();
system("Pause");
return 0;
}
張貼留言