I am taking a C++ programming class and I'm new to this and I just don't get sum of the assignments.. I am suppose to write a program that will display the square root of the sum of num1 and num2. And I can't figure it how.. Can anyone help me out..
I am taking a C++ programming class and I'm new to this and I just don't get sum of the assignments.. I am suppose to write a program that will display the square root of the sum of num1 and num2. And I can't figure it how.. Can anyone help me out..
Add the two numbers together, then send that value to the sqrt() function in math.h.
Please don't expect someone on these boards to do your assignment for you. If you haven't been following what's going on in class, you can read some of the tutorials on this web site.
I don't expect someone on this site to do my assignment for me I just don't understand it and I keep getting errors when I do exactly what you said.
Post your code (don't forget to use the [code] tags), and the errors, then perhaps we can help
[QUOTE]
Here is the error
-------------------Configuration: T5ConE03 - Win32 Debug--------------------
Compiling...
T5ConE03.cpp
T5ConE03.cpp(22) : error C2065: 'sqRoot' : undeclared identifier
T5ConE03.cpp(26) : error C2676: binary '>>' : 'class std::basic_ostream<char,struct std::char_traits<char> >' does not define this operator or a conversion to a type acc
eptable to the predefined operator
Error executing cl.exe.
T5ConE03.exe - 2 error(s), 0 warning(s)
[QUOTE]
The books sucks to be a Intro to Programming book especially if you have never done programming before like me..
I don't understand how to post the program on the site but I think I am just frustrated with this stupid assignment right now.
Here is an example of how sqrt is used...
Code:#include <iostream> #include <cmath> using std::cout; using std::endl; using std::cin; using std::sqrt; int main() { cout << sqrt(144) << endl; /* Will print 12 to stdout */ cin.get(); /* Holds the console window open depending on the compiler you are using */ return 0; }
Last edited by Scribbler; 03-27-2005 at 11:10 PM.
At shawnaj7825 ok use code tags , is really easy to use, is like using html beguin with [code] and finish with [ / code ] but with out space, and It's a relief for the eyes.
well just relax and all the code will appear. Take your time, don't rush yourself. And read the tutorials http://www.cprogramming.com/begin.html
幸運
Thank you scribbler and vermilion... That was all I needed.. I didn't need someone to think I was trying to get them to my work I just need a example or some form of help because the book I am using sucks and my instructor doesn't even provide examples to help us out. I really appreciate ya'll taking time out to reply... Again thank you..
There are plenty of C++ books, so I suggest you get a jump on the rest of your class, and buy a better one:Originally Posted by shawnaj7825
1) Ivor Horton's Beginning C++
A fairly rigorous book, with detailed explanations, which you could use as a reference for things you don't understand.
2) Sam's Teach Yourself C++ in 21 Days
A book that is a bit easier, and it's recommended by lots of beginners.
3) C++: A Beginner's Guide
A really basic book, which is the shortest book of the three.