C++ Passing user input to a variable to a parameter for a function in -
Comes to programming, but I'm watching some tutorials on YouTube and I decided to read in different videos Try mixing some concepts. What I want to do is a function that has 3 criteria which calculates returns on the stock market investment. In my main, I want to get 3 parameters of the function from the user and want to store each one in one variable and when I call on my function then use those variables for the parameter. I am currently getting an error, but before I write the whole thing, I will only show you my code and you can probably solve the problem.
#include & lt; Iostream & gt; # Include & lt; Semith & gt; using namespace std; Float stock market clutter (float p, float r, et t) {float a; For (int day = 1; day & lt; = t; day ++) {a = p * paw (1 + r, day); Cout & lt; & Lt; A & lt; & Lt; Endl; }} Int main () {float p; Float R; Int t; Cout & lt; & Lt; "Please enter the principle" & lt; & Lt; Endl; Cin & gt; & Gt; P & gt; & Gt; Endl; Cout & lt; & Lt; "Please enter rate" & lt; & Lt; Endl; Cin & gt; & Gt; R & gt; & Gt; Endl; Cout & lt; & Lt; "Please enter time in days" & lt; & Lt; Endl; Cin & gt; & Gt; T & gt; & Gt; Endl; Cout & lt; & Lt; Stock Markacquette (P, R, T); Return 0; } First error: Your stockmarket closeout function should return the value! return; The second error (3 times): Cin is not required in the endline. Just remove it.
Enjoy!
Comments
Post a Comment