c++快速入门的第6讲的课后题answer
我自己做的answer,请大家看看哪里有问题:#include<iostream>
using namespace std;
long cal ( int x );
long cal ( int x, int y );
long cal ( int x, int y ,int z );
int main()
{
int i,j,k;
cout << "Please enter 1 number: " ;
cin >> i;
cout << cal( i );
cout << "\n";
cout << "please enter 2 numbers: ";
cin >> i >> j;
cout << cal ( i, j);
cout << "\n";
cout << "please enter 3 numbers:";
cin >> i >> j >> k;
cout << cal(i,j,k);
cout << "\n";
return 0;
}
long cal ( int x )
{
return (x * x );
}
long cal ( int x, int y )
{
return (x * y );
}
long cal ( int x, int y ,int z )
{
return (x + y + z );
}
支持小甲鱼~~
页:
[1]