Did you intend for the line:
cout<<end;
to really be:
cout<<endl;
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;
}
6 answers
i tried and it didn't work :<
and you email me a uncompiled answer?
sonnytsn1_@_gm_ai_l._co_m
and you email me a uncompiled answer?
sonnytsn1_@_gm_ai_l._co_m
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;
}
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;
}
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;
}
-------------------------
#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;
}
I guess the double blank lines caused the posting applet to clip the last two lines. Here they are finally, I hope.
--------------------
return 0;
}
--------------------
return 0;
}
Nope, for some reason the last lines which are not posting.
Anyway, the last lines are the same as your source.
Anyway, the last lines are the same as your source.