Hey guys, I've just started coding C about a week ago and I'm getting an error in two lines of code one saying "Called object type 'int' is not a function or function browser" and "Called object type 'int' is not a function or function browser". I'd like to know why that's happening in my program but also what that means in general. Another one that isn't actually failing the build is "Conversion specifies build type 'double' but the argument has type 'double *', and I was wondering what that means. All the errors are in the "a series" function. The point of the code in this section is to loop a certain number of times, (entered by the user(n)) adding a function during each iteration of the loop, with a time input (t). Thanks for the help. Here's the code
Code:
#include <stdio.h>
#include <time.h>
#include <math.h>
#define pi 3.141593
int aseries();
int bseries();
int cseries();
int main()
{
//Beginning program stuff
//Defining variables to find the time
time_t now;
time(&now);
printf("%s\n", ctime(&now));
printf("--------------------------------------------------------------\n");
//Main Program
char choice;
printf("What type of evaluation would you like to perform?\n\t1.)Calculate voltage for a given value of time.\n\t2.)Input t and epsilon.\n\t3.)Find the change in voltage between t2 and t1.\nEnter '1' for choice one, '2' for choice two, or '3' for choice three: ");
scanf("%d",&choice);
if (choice == 1){
aseries();
}
if (choice == 2){
bseries();
}
if (choice == 3){
cseries();
}
return 0;
}
int aseries()
{
double t;
int n;
double total=0;
double v;
//Prompting the user for time input
printf("Enter the time you would like to evaluate the voltage at: ");
scanf("%lf",&t);
//Prompting the user for number of terms in the series
printf("Enter the number of terms in the series you would like: ");
scanf("%lf",&n);
//Building the series
for (int i=0;i<=n;i++){
total = total + ((1/((2(i)-1)^2))*cos(((2(i)-1)*pi*t)/3)) //This is where the "Called object type 'int'..." error is
}
v=(3/2)-(12/pow(pi,2))(total); //This is where the "Called object type 'double'..." error is
printf("%lf",&v); //This is where the "Conversion specifics type..." error is
return 0 ;
}
int bseries()
{
double t;
double e;
//Prompting the user for time input
printf("Enter the time you would like to evaluate the voltage at: ");
scanf("%lf",&t);
//Prompting the user for epsilon input
printf("Enter the epsilon value you would like to use: ");
scanf("%lf",&e);
return 0;
}
int cseries()
{
double t1;
double t2;
int n;
//Prompt the user for time inputs
printf("Enter the beginning of the time you would like to evaluate the voltage at: ");
scanf("%lf",&t1);
printf("Enter the end of the time you would like to evaluate the voltage at: ");
scanf("%lf",&t2);
//Prompting the user for number of terms in the series
printf("Enter the number of terms in the series you would like: ");
scanf("%lf",&n);
return 0;
}