1

# include<iostream>
# include<cstring>
# include<cstdio>
using namespace std;
int main()
{
	char s[1000],shu[1000],mifuhao='+';
	int i,j,l1,l2,mi=0,tn=1;
	cin>>s;
	l1 = strlen(s);
	for(i=0;i<l1;i++)
	{
		if(s[i]=='*')
		{
			for(j=0;j<i;j++)	shu[j]=s[j];
			l2=i;
		}
		else if(s[i]=='^')
		{
			for(j=l1-1;j>i;j--)
			{
				if(s[j]=='-')
				{
					mifuhao = '-';
					break;
				}
				mi = mi + (s[j]-'0')*tn;
				tn = tn*10;
			}
			break;
		}
	}
	cout<<shu[i];// 会出现乱码,原因在于截止位置不清
        for(j=0;j<l2;j++)	printf("%c",shu[j]); //不会出现乱码
	return 0;
』

  

	for(i=0;i<r1;i++)
		{
			for(j=0;j<c2;j++)
			{
				for(k=0;k<r2;k++)
					ab[i][j] += a[i][k]*b[k][j];
				cout<<ab[i][j];
				if(j!=c2-1)	cout<<" ";		
		    }
		    if(i!=r1-1)	cout<<endl;
		}

矩阵相乘

  

原文地址:https://www.cnblogs.com/wshyj/p/6843676.html