according to the C++primer book,
size_t k=get_size();
int *a=new int[k];
i apply this to my program ,but when i debug the program ,it happens that "error C2065: 'get_size' : undeclared identifier"
i do not know why.
Here is my program:
#include <iostream>
#include <cmath>
#include <cstddef>
using namespace std;
int main(){
unsigned long int n;
unsigned long int t;
t=sqrt(n);
unsigned long int i,j,h=1,p=0;
size_t k=get_size();
int *a=new int[k];
int *b=new int[k];
for(i=2;i<t;i++){
for(j=2;j<=(i/j);j++)
if(!(i%j))break;//如果找到了一个因数,那么该数就是质数
if(j >(i/j)) {
a[p++]=i;
k=p;
}
}
for(p=0;p<k;p++){
while(t){
t=n/a[p];
h++;
n/=a[p];
}
b[p]=h;
}
for(p=1;p<k-1;p++){
cout<<n<<" = "<<a[p]<<"^"<<b[p]<<" * ";
}
if(p=k-1) cout<<a[p]<<"^"<<b[p];
delete []a;
delete []b;
return 0;
}