Post a New Question

C++ Programming

posted by on .

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;
}

  • C++ Programming - ,

    Did you intend for the line:
    cout<<end;

    to really be:
    cout<<endl;

  • C++ Programming - ,

    i tried and it didn't work :<

    and you email me a uncompiled answer?

    sonnytsn1_@_gm_ai_l._co_m

  • C++ Programming - ,

    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;
    }

  • C++ Programming - ,

    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;
    }

  • C++ Programming - ,

    I guess the double blank lines caused the posting applet to clip the last two lines. Here they are finally, I hope.
    --------------------
    return 0;
    }

  • C++ Programming - ,

    Nope, for some reason the last lines which are not posting.
    Anyway, the last lines are the same as your source.

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question