# Value "p" cannot use a fucntion

Value "p" cannot use a fucntion
0

#1

Write a program which will calculate the value of x using the following options
x=p(1+k)^r
where k =30% of p
Enter the value of p and r from the user

I wrote this:

``````{

float x;
float p,k,r;
cout<<"Please enter the value of P";
cin>>p;
k=(p/100)*30;
cout<<"k";
cout<<k;
cout<<"Please enter the value of r";
cin>>r;
x={p(1+k)^r};
cout<<"x";
cin>>x;
return 0;

}
``````

it giving the error that P cannot use as a function…

#2

I don’t even know what language it is!

#3

Looks like c++ to me.

#4

Thats because of p(). It thinks your trying to type a function like… TestFunction();

Type this instead. x={p * (1+k)^r};

Example in use. Javascript not cpp. Fix still applies.

THIS WILL NOT WORK IN FORUM. OPEN IN REPL.IT

#5

I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (`</>`) will also add backticks around text.

#6

Sorry its C++ language

#7

Not sure what are those brackets in"x={p(1+k)^r};" for but i’m gonna guess that you want to assign p * (1 + k) ^ r to the x variable.
If yes than add the missing multiplication symbol and use pow function instead of “^”.
http://www.cplusplus.com/reference/cmath/pow/

Spoiler
``````x = pow(p * (1 + k), r);
``````

#8

Yep I didn’t quite get the brackets either. Figured it was a cpp thing.