#include<iostream>int main(){ using namespace std; double x,n,y; y = 1; double xn(double x,double n,double y); cout<<"请输入 x 和 n : "; cin >> x >> n; cout << endl << "x 的 n 次幂为 :" << xn(x,n,y);} double xn (double x,double n,double y){ y *= Read More
posted @ 2013-04-05 21:22 迷路君的博客 Views(251) Comments(0) Diggs(0) Edit
#include<iostream>template < class T > T larger(T a,T b); // 不能放在main函数里面main(){ using std::cout; int a = 1; int b = 100; cout << larger( a ,b );}template < class T > T larger(T a,T b){ return a > b ? a : b;} Read More
posted @ 2013-04-05 14:00 迷路君的博客 Views(181) Comments(0) Diggs(0) Edit
原本对于二维数组a[3][4]中的a[0]究竟指什么不确定,用了一段代码检验下#include<iostream>main(){ using std::cout; using std::endl; int a[3][4]; cout <<endl << "sizeof a == "<<sizeof a <<endl <<"i == "<<sizeof a/sizeof a[0]<<endl <<"sizeof a[0] == " Read More
posted @ 2013-04-05 13:54 迷路君的博客 Views(701) Comments(0) Diggs(0) Edit