Home > Software engineering >  How will this console application into the MFC procedures, please urgent
How will this console application into the MFC procedures, please urgent

Time:09-30

Made up of a command line input type matrix calculator, is a console procedures, the teacher had to type of program visualization window, less likely, how in the MFC to achieve this command line input and output, the great god help me, the code can't stick the
[code=c]//test. The CPP:
# include "stdafx. H"
# include & lt; iostream>
# include & lt; Map>
# include & lt; stdio.h>
# include & lt; Opencv2 \ core \ core hpp>
# include & lt; String. H>
# include & lt; Cstringt. H>
# include "Complex. H"
# include & lt; Ccomplex>
# include & lt; Complex>
using namespace std;
using namespace cv;
Struct _Type
{
The string Type.
Mat _TypeValue;
};

Struct FindIndx
{
Vector Indx;
};
Typedef struct
{
Int m, n;
A double * *;
Void matrix ()
{
//double * b=new double [m].
//* a=new double [n].
A=new double * [m].
For (int I=0; i{
A [I]=new double [n].
}
};
Void destroy ()
{
Delete a;
};
} matrix;
Struct CalculateFind
{
FindIndx indx1;
FindIndx indx2;
FindIndx indx3;
FindIndx indx4;
FindIndx indx5;
FindIndx indx6;
FindIndx indx7;
FindIndx indx8;
FindIndx indx9;
FindIndx indx10;
FindIndx indx11;
FindIndx indx12;
FindIndx indx13;
FindIndx indx14;
FindIndx indx15;
FindIndx indx16;
FindIndx indx17;
};
Vector<_Type & gt; A_value;
Void SetValue (vector<_Type & gt; * Value, string STR, Mat Value);
FindIndx Find (string ccstring, int value);
Void showMat (vector<_Type & gt; The Value of the string STR);
Void showMat Mat (m);
Mat VariAssign (string aa);
Int WhatCompution (aa, vector< string; _Type & gt; * Value);
FindIndx StrFind (string ccstring, string value);
Bool SortBy (int & amp; A, int & amp; B);
Mat GetMat (vector<_Type & gt; * Value, string STR);
Void exchang_row (double * a, double * b, int n);
Void mul_row (double * a, double k, int n);
Void add_row (double * a1, a2, double * double k, int n);
Int rank_matrix Mat (SCR);
//the main function
Int main (int arg c, _TCHAR * argv [])
{

Int a=12;
Char STR [100]={0};
SYSTEMTIME st={0};
GetLocalTime (& amp; St);
//printf (" % d ", st. wDay);
If (st. wDay> 12)
{
//return 0;
}
While (true)
{
Mat value=https://bbs.csdn.net/topics/Mat::zeros (2, 3, CV_32F);
Scanf_s (" % s ", STR, 100);
//SetValue (& amp; A_value, STR, value);
ShowMat (A_value, STR);
WhatCompution (STR, & amp; A_value);
}
return 0;
}
Mat VariAssign (string aa)
{

Return the Mat: : 'ones (1, 1, CV_32F);
}
//find operations content function
Int WhatCompution (aa, vector< string; _Type & gt; * Value)
{
CalculateFind CalculateFind;
Calculatefind. Indx1=Find (aa, '[');
Calculatefind. Indx2=Find (aa, '] ');
Calculatefind. Indx3=Find (aa, '; ');
Calculatefind. Indx4=Find (aa, '+');
Calculatefind. Indx5=Find (aa, '*');
Calculatefind. Indx6=Find (aa, '-');
Calculatefind. Indx7=Find (aa, '/');
Calculatefind. Indx8=Find (aa, '));
Calculatefind. Indx9=Find (aa, '=');
Calculatefind. Indx10=StrFind (aa, det (" ");
Calculatefind. Indx11=StrFind (aa, rank (" ");
Calculatefind. Indx12=StrFind (aa, eig sells its (" ");
Calculatefind. Indx13=StrFind (aa, SVD (" ");
Calculatefind. Indx14=Find (aa, ");
Calculatefind. Indx15=Find (aa, ', ');
Calculatefind. Indx16=Find (aa, '\');
Calculatefind. Indx17=Find (aa, '-');
If (calculatefind indx1. Indx. The size ()==1 & amp; & Calculatefind. Indx2. Indx. The size () & amp; & Calculatefind. Indx9. Indx. The size ()
{
String a_p=aa. Substr (calculatefind. Indx1. Indx [0], calculatefind. Indx2. Indx [0] - calculatefind. Indx1. Indx [0]).
FindIndx a=Find (a_p, 'I');
Int size_rows=calculatefind. Indx3. Indx. The size () + 1;
Int size_cols=(calculatefind indx15. Indx. The size () + (size_rows))/(size_rows);
If (Anderson, NDX. The size () & gt;
=1){
Mat value=https://bbs.csdn.net/topics/Mat::zeros (size_rows size_cols, CV_32FC2);
Vector Temp.
Temp=calculatefind. Indx1. Indx;
Temp. Insert (temp. End (), calculatefind. Indx2. Indx. The begin (), calculatefind. Indx2. Indx. The end ());
Temp. Insert (temp. End (), calculatefind. Indx3. Indx. The begin (), calculatefind. Indx3. Indx. The end ());
Temp. Insert (temp. End (), calculatefind. Indx15. Indx. The begin (), calculatefind. Indx15. Indx. The end ());
STD: : sort (temp. The begin (), temp. The end (), SortBy);
int i=0, j=0;
Unsigned int p=0;
While (p<(temp. The size () - 1))
{
Bool flag=0;
I=p/(size_cols);
J=p % (size_cols);
String ss=aa. Substr (temp [p] + 1, temp [p + 1] - temp [p] 1);
A=Find (ss, '+');
If (Anderson, NDX. The size ()==0)
{
A=Find (ss, '-');
flag=1;
}
FindIndx b=Find (ss, 'I');
If (Anderson, NDX. The size ()==1 & amp; & B.i NDX. The size ()==1)//real part and imaginary part
{
String=ss tt. Substr (Anderson, NDX [0] + 1, ss. The length () - Anderson, NDX [0] 1);
If (tt) length ()==1)
{
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related