diff --git a/5_practice.c b/5_practice.c index 70d6651..b69de9b 100644 --- a/5_practice.c +++ b/5_practice.c @@ -2,39 +2,47 @@ #include // for memory allocation #include // for time calculation #include // for sine and cosine functions + int main() { // Declare all the variables - int k, n, N; + int u ,k, n, N; double *x, *yr, *yi; time_t t; // Input the number N - - + printf("Please input a number N = "); + scanf("%d", &N); // Locate the memory for x, yr, yi; - - // Initial setting for x, for example, x[k] = k - - - - + x = (double *) malloc(N*sizeof(double)); + yr = (double *) malloc(N*sizeof(double)); + yi = (double *) malloc(N*sizeof(double)); + + // Initial setting for x, for example, x[k] = k, k=0..N-1 + for(k=0;k