Asked by sonnytsn

Can any1 please fix this c++ source problem

/*Circle Are program
Calculates the area of a circle using the formula A=pi * r * r
Sonny Hinh, 1/23/08

#include <iostream.h>

int main()
{
cout << "-Calculate the area of a circle-" << endl;
cout << end;
cout << "Radius = " << 10 << endl;
cout << "Area = " << (3.14*10*10) << endl;
return 0;
}

Answers

Answered by Quidditch
Did you intend for the line:
cout<<end;

to really be:
cout<<endl;
Answered by sonnytsn
i tried and it didn't work :<

and you email me a uncompiled answer?

sonnytsn1_@_gm_ai_l._co_m
Answered by Quidditch
I did a quick check using MS VS2005. The following compiles correctly. Changing the line:
cout<<endl;

to:
cout<<end;
gives a compile error
--------------------------------
Below compiles using VS2005
--------------------------------

#include <tchar.h>
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
cout << "-Calculate the area of a circle-" << endl;
cout << endl;
cout << "Radius = " << 10 << endl;
cout << "Area = " << (3.14*10*10) << endl;

return 0;
}
Answered by Quidditch
missed the end
-------------------------

#include <tchar.h>
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
cout << "-Calculate the area of a circle-" << endl;
cout << endl;
cout << "Radius = " << 10 << endl;
cout << "Area = " << (3.14*10*10) << endl;

return 0;
}
Answered by Quidditch
I guess the double blank lines caused the posting applet to clip the last two lines. Here they are finally, I hope.
--------------------
return 0;
}
Answered by Quidditch
Nope, for some reason the last lines which are not posting.
Anyway, the last lines are the same as your source.

There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions