void main()
{
double opd1,opd2,result;
char op;
cout << \"please input the first number : \" ;
cin >> opd1 ;
cout<<\"please input arithmetic operator(+、_、*、/):\";
cin>> op;
cout << \"please input the second number : \" ;
cin >> opd2 ;
if( opd1!=0 && opd2!=0 )
{
if (op == \'+\' || op == \'-\' || op == \'*\' || op == \'/\' )
{
switch(op)
{
case \'+\':
result = opd1 + opd2;
cout<<opd1<< op << opd2<<\"=\"<<result<<endl;
break;
case \'-\':
result = opd1 - opd2;
cout<<opd1<< op << opd2<<\"=\"<<result<<endl;
break;
case \'*\':
result = opd1 * opd2;
cout<<opd1<< op << opd2<<\"=\"<<result<<endl;
break;
case \'/\':
result = opd1 / opd2;
cout<<opd1<< op << opd2<<\"=\"<<result<<endl;
break;
default : cout <<endl;
}
}
else cout << \"This is not a arithmetic expression ! \"<<endl;
}
}
C++忘光了.逆序输出的那个基本就那个程序.我稍微的补了点.不知道对不对.
#include <iostream>
using namespace std;
int main()
{
int i,j;
int a[3][4] ;
for (i=0;i<3;i++)
{
Cout<<”input number of the lines ”<<i<<endl;
for (j=0;j<4;j++)
{
cin >> a[j];
}
}
cout<<”output the arry”<<endl;
for (i=2;i>=0;i--)
{
for (j=3;j>=0;j--)
{
cout << a[j] << \" \" ;
}
}
return 0;
}