请教c++ 矩阵运算问题

shi_tou 2007-04-26 09:27:00
问题在程序后面的注释里啊





// 类面向对象.cpp : Defines the entry point for the console application.
//

#include <iostream>
using namespace std;
#include "class.h"
int main(int argc, char* argv[])
{
char choice;
cout<<endl;
cout<<endl;
cout<<" A Calculator Of matrix "<<endl;
cout<<" made by zzy in 2007.4.25"<<endl;
cout<<endl;
cout<<"0:exit."<<endl; //退出
cout<<"1:addition."<<endl; //加法
cout<<"2:subtration."<<endl; //减法
cout<<"3:multiplication."<<endl; //乘法
cout<<endl;
cout<<"please input your choice:"<<endl;
cin>>choice;
Cmatrix mymatrix1,mymatrix2,mymatrix3;
mymatrix1.getnumber();
mymatrix2.getnumber();
states flag;
//用switch判断参与什么运算
switch(choice)
{
case '0':
exit( 0 );
break;
case '1':
flag=mymatrix1.add(mymatrix2,mymatrix3);
if(flag==noerror)
{
mymatrix3.shownumber();
}
else
{
cout<<"error in addition"<<endl;
}
break;
case '2':
flag=mymatrix1.sub(mymatrix2,mymatrix3);
if(flag==noerror)
{
mymatrix3.shownumber();
}
else
{
cout<<"error in subtration"<<endl;
}
break;
case '3':
flag=mymatrix1.mul(mymatrix2,mymatrix3);
if(flag==noerror)
{
mymatrix3.shownumber();
}
else
{
cout<<"error in multiplication"<<endl;
}
break;
default:
cout<<endl;
cout<<"wrong choice."<<endl;
break;
}
return 0;
}


/*其实只要有输入,那isemtpy()就没有什么作用啊
因为其必定不为NULL啊 */
...全文
284 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaooqiang 2007-04-27
  • 打赏
  • 举报
回复
不明白
banzhiyu 2007-04-27
  • 打赏
  • 举报
回复
还是不太明白楼主的问题

65,212

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧