What's the glitch?


#inlcude <iostream>
#include <cmath>
using namespace std;

int main()
{
for (int x(0); x<6; x++)
{
cout<< "\t" << x << "\t"<< sqrt(x)<< "\n";

}
return 0;
}
Many of the functions in <cmath> are not meant to be used with integral types.
Try spelling #include correctly on line 1.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.

Thanks man, AbstractionAnon..Even I was thinking about how to edit my posts! (:
EDIT: You deleted and reposted a different post while I was writing. It is not clear to me whether you solved your problem.

The code compiles fine for me after fixing the "inlcude" typo. It even generates the correct output. What compiler are you using? Some have issues with <c****> headers and overload resolution because they are non-conforming (e.g. old MSVC versions).
Last edited on
Ya..It was just the typo!Problem solved.
I've got an other doubt..If you care to explain..
What are the functions of \v and \f..Any link related to this would be appreciated!
Those are escape sequences, most languages and tools support them. For C++:
http://en.cppreference.com/w/cpp/language/escape
Note that some are no longer relevant in this current day and age (e.g. bell and backspace)
Last edited on
Thanks LB
Topic archived. No new replies allowed.