C++ Programming

posted by .

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.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. C++

    Can anyone help me with my c++ program? Its a program I have to write using structs and arrays and i'm stuck. If anyone can help can you post back and I'll show you what i've got and maybe you can tell me why its not working correctly.
  2. C++ Programming

    I NEED HELP WITH MY CODE!!! it won't compile right The formula for finding the force of gravity between two objects is Force = grav * (mass1 * mass2) / (radius * radius), where Force = the force of gravity between the two objects, …
  3. C++ Programming

    #include <iostream.h> #include <stdlib.h> #include <math.h> int main ( ) { double noe, nod, dc1, dc2, dc3, dc4, t; cout << "Enter number of eggs: "; cin >> noe; nod = noe / 12; dc1 = .50 / 12; dc2 = .45 …
  4. C++ Programming

    I have to redo programming exercise 5 of chapter 9 using dynamic arrays. but I have the information but I don't know how to use it in a dynamic arrays please help. //Chapter 9: Programming Exercise 5 #include <iostream> #include …
  5. C++

    I have no idea how to construct this program. Any help is appreciated. Thank you. In a population, the birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population …
  6. C++ if else problem, please look

    It compiles but it doesn't work. can you tell me what i did wrong?
  7. programming C++

    Write a program that reads test scores up to 30 into an array. sentinel will stop when -1 is entered. Write functions that: 1. read the scores into arrays 2. computes the distribution based on whether they are As, Bs and so on 3. find …
  8. C++

    Would you check and correct my error please! ******************************* #include<iostream.h> #include<string.h> #include<bitset> viod Binary_to_Decimal(); int main(int argv,char argc) { while(1<2) { int m_choise; …
  9. Programing

    Write a full program that reads in an arbitrary sequence of integers from the standard input, and writes them to the standard output in sorted order and with all duplicates removed. You may assume the input contains at most 100 integers …
  10. C++

    I am trying to create a program that displays shipping charges for two region codes. The region code has to have exactly 3 characters (the letter A or B followed by two numbers). Display a message if invalid region code is entered. …

More Similar Questions