http://www.bettycat.com/home/ages.html It tells your cat's age, but it varies up to year two, but at three and above, you just add three more years. How could I write an equation that would work in all instances (<--spelling?) no matter if the user inputs 3.956 or 2, just a consistent equation? All I really need is the equation I think, or equations. I think I could figure out the cout and cin stuff. You said making a program that would factor a trinomial or whatever would be a pain, do you mean by that that it would be complicated or just time consuming, but easy? What does the C++ thing "if" do? Could I do this?
Code: Select all
cout << "Input your cat's age.";
cin >> A
if A=1.5 << B
if A=2.5 << C
I would actually use this command, but basically how do you say the following in proper C++ code? "if variable A = (a certain number) then duplicate variable A and store the duplicate as B. If variable A=2.5 then duplicate variable A and store the duplicate as C. The the program would later define variables B and C and "cout" them to the user. But I would like to know this stuff, but in my case, all I would need is a mathematical formula. But how does "if" work? And how can I make an option at the end of a console program that would let the user restart that program without closing it and opening it again? Oh yeah, can you do this
Code: Select all
X=(D+B)^2
If that doesnt work, how would I be able to complete this:
E=(square root of(C-A)^2 + (D - B)^2) or this
F=((A + C)/2) Would the proper code for the F= thing be as I wrote it? What I really need is raising the variables inside the ( ) to the second or third, and also how could I do the cubed root or fourth root of something in proper code?