Cora Dyce

Welcome to our website !
Please register an account to view the complete categories and forums.

Cora Dyce - Your personal dicing clan


    Do my C++ homework for me >:)

    Share
    avatar
    Aid
    VIP
    VIP

    Posts : 2814
    Join date : 2011-07-04
    Age : 23
    Location : Arizona

    Do my C++ homework for me >:)

    Post by Aid on 2013-03-28, 21:22

    I'll end up google searching shit last minute but I figured since I do that almost every assignment, I should post it up right now. It's not due til next Thursday so I got time to think about it and work it out but I'm just interested to see if anyone here can do this. It is still very simple, it's intro to C++.

    avatar
    Vaqq
    Member
    Member

    Posts : 1519
    Join date : 2012-07-15

    Re: Do my C++ homework for me >:)

    Post by Vaqq on 2013-03-29, 12:37

    AskMistro.com
    avatar
    Aid
    VIP
    VIP

    Posts : 2814
    Join date : 2011-07-04
    Age : 23
    Location : Arizona

    Re: Do my C++ homework for me >:)

    Post by Aid on 2013-03-30, 04:27

    Vaqq wrote:AskMistro.com
    PayMistroforDiscreetService.com

    I visited but Mistro was not available Sad
    avatar
    Allen's Slave
    Member
    Member

    Posts : 4445
    Join date : 2012-08-09
    Age : 23
    Location : A$AP

    Re: Do my C++ homework for me >:)

    Post by Allen's Slave on 2013-03-30, 04:41

    Aid wrote:
    Vaqq wrote:AskMistro.com
    PayMistroforDiscreetService.com

    I visited but Mistro was not available Sad

    Lmao just saw this...

    Currently obtaining both domain names.
    avatar
    Aid
    VIP
    VIP

    Posts : 2814
    Join date : 2011-07-04
    Age : 23
    Location : Arizona

    Re: Do my C++ homework for me >:)

    Post by Aid on 2013-03-31, 20:55

    Mistro | Tom wrote:
    Aid wrote:
    Vaqq wrote:AskMistro.com
    PayMistroforDiscreetService.com

    I visited but Mistro was not available Sad

    Lmao just saw this...

    Currently obtaining both domain names.
    You'll make millions.. Genius Smile
    avatar
    Aid
    VIP
    VIP

    Posts : 2814
    Join date : 2011-07-04
    Age : 23
    Location : Arizona

    Re: Do my C++ homework for me >:)

    Post by Aid on 2013-04-04, 01:17

    WHAT THE FUCK AM I DOING WRONGGGGGGGGGGGGGGGG.

    Mistro help kthx. As I posted before due tomorrow lolol.

    I can't get the data to calculate correctly, it just keeps giving me 0.0 for each of the values when I run it -.- and atm I'm so brain dead I probably missed something.. Other than the values not showing, I have the code working.

    Also, my code looks better, the indentation doesn't show proper on here..
    =======================================================

    #include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <string>

    using namespace std;


    //structure declarations
    struct Circle
    {
    double radius;
    double diameter;
    double area;
    double circumference;

    //default constructor here
    Circle()
    {
    radius = 0;
    diameter = 0;
    area = 0;
    circumference = 0;
    }

    }; //struct Circle

    //function prototypes here
    Circle getCircleData();
    void calculateCircleData(Circle &);
    void displayCircleData(Circle);
    bool tryAgain();


    int main()
    {
    Circle circle;
    int number = 0;
    do
    {
    number++;

    cout << "Welcome to our Circle Calculator\n";
    cout << "--------------------------------";
    cout << endl;
    cout << "Circle #" << number << endl;

    getCircleData();
    calculateCircleData(circle);
    displayCircleData(circle);

    }while (tryAgain());


    }
    //function implementation here
    Circle getCircleData()
    {
    Circle circle;

    cout << "Enter the radius of the circle (number greater than 0): ";
    cin >> circle.radius;

    while (circle.radius < 0)
    {
    cout << "Not a valid input, please enter a valid input (number greater than 0): ";
    cin >> circle.radius;
    }

    return circle;
    }

    void calculateCircleData(Circle &)
    {
    Circle circle;

    circle.diameter = (circle.radius * 2);
    circle.area = (3.1416 * pow(circle.radius, 2));
    circle.circumference = (2 * 3.1416 * circle.radius);
    }

    void displayCircleData(Circle)
    {
    Circle circle;

    cout << fixed << setprecision(2);
    cout << endl;
    cout << "The circle data is \n";
    cout << "Radius: " << setw (6) << circle.radius << endl;
    cout << "Diameter: " << setw (6) << circle.diameter << endl;
    cout << "Circumference: " << setw (6) << circle.circumference << endl;
    cout << "Area: " << setw (6) << circle.area << endl;
    }

    bool tryAgain()
    {
    char again;
    cout << "Do you want to try again? (Y or N) ";
    cin >> again;

    if (again == 'Y' || again == 'y')
    {
    return true;
    }
    return false;
    }
    avatar
    Allen's Slave
    Member
    Member

    Posts : 4445
    Join date : 2012-08-09
    Age : 23
    Location : A$AP

    Re: Do my C++ homework for me >:)

    Post by Allen's Slave on 2013-04-04, 01:51

    Aid wrote:WHAT THE FUCK AM I DOING WRONGGGGGGGGGGGGGGGG.

    Mistro help kthx. As I posted before due tomorrow lolol.

    I can't get the data to calculate correctly, it just keeps giving me 0.0 for each of the values when I run it -.- and atm I'm so brain dead I probably missed something.. Other than the values not showing, I have the code working.

    Also, my code looks better, the indentation doesn't show proper on here..
    =======================================================

    #include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <string>

    using namespace std;


    //structure declarations
    struct Circle
    {
    double radius;
    double diameter;
    double area;
    double circumference;

    //default constructor here
    Circle()
    {
    radius = 0;
    diameter = 0;
    area = 0;
    circumference = 0;
    }

    }; //struct Circle

    //function prototypes here
    Circle getCircleData();
    void calculateCircleData(Circle &);
    void displayCircleData(Circle);
    bool tryAgain();


    int main()
    {
    Circle circle;
    int number = 0;
    do
    {
    number++;

    cout << "Welcome to our Circle Calculator\n";
    cout << "--------------------------------";
    cout << endl;
    cout << "Circle #" << number << endl;

    getCircleData();
    calculateCircleData(circle);
    displayCircleData(circle);

    }while (tryAgain());


    }
    //function implementation here
    Circle getCircleData()
    {
    Circle circle;

    cout << "Enter the radius of the circle (number greater than 0): ";
    cin >> circle.radius;

    while (circle.radius < 0)
    {
    cout << "Not a valid input, please enter a valid input (number greater than 0): ";
    cin >> circle.radius;
    }

    return circle;
    }

    void calculateCircleData(Circle &)
    {
    Circle circle;

    circle.diameter = (circle.radius * 2);
    circle.area = (3.1416 * pow(circle.radius, 2));
    circle.circumference = (2 * 3.1416 * circle.radius);
    }

    void displayCircleData(Circle)
    {
    Circle circle;

    cout << fixed << setprecision(2);
    cout << endl;
    cout << "The circle data is \n";
    cout << "Radius: " << setw (6) << circle.radius << endl;
    cout << "Diameter: " << setw (6) << circle.diameter << endl;
    cout << "Circumference: " << setw (6) << circle.circumference << endl;
    cout << "Area: " << setw (6) << circle.area << endl;
    }

    bool tryAgain()
    {
    char again;
    cout << "Do you want to try again? (Y or N) ";
    cin >> again;

    if (again == 'Y' || again == 'y')
    {
    return true;
    }
    return false;
    }

    Let me see what I can find. Smile
    avatar
    k099str
    Recruit
    Recruit

    Posts : 1180
    Join date : 2013-03-20
    Age : 23
    Location : Wisconsin

    Re: Do my C++ homework for me >:)

    Post by k099str on 2013-04-04, 02:54

    coding looks really intimidating.
    avatar
    Aid
    VIP
    VIP

    Posts : 2814
    Join date : 2011-07-04
    Age : 23
    Location : Arizona

    Re: Do my C++ homework for me >:)

    Post by Aid on 2013-04-04, 03:07

    Mistro here:
    http://cplusplus.com/forum/general/97843/

    Easier to read code, plus some guy is trying to help me. Still I don't have it but that's my latest code in easier to read formatting Smile

    Edit: I figured it out Smile Even though that guy helped me a lot, it seems a lot of the 'smart c++ people' are really douchey towards beginners. Like they expect we should know everything that we make mistakes on lol.
    avatar
    Allen's Slave
    Member
    Member

    Posts : 4445
    Join date : 2012-08-09
    Age : 23
    Location : A$AP

    Re: Do my C++ homework for me >:)

    Post by Allen's Slave on 2013-04-04, 05:21

    Aid wrote:Mistro here:
    http://cplusplus.com/forum/general/97843/

    Easier to read code, plus some guy is trying to help me. Still I don't have it but that's my latest code in easier to read formatting Smile

    Edit: I figured it out Smile Even though that guy helped me a lot, it seems a lot of the 'smart c++ people' are really douchey towards beginners. Like they expect we should know everything that we make mistakes on lol.

    Sorry bud, had training all night! Glad you got it though! Smile

    And yeah.. Please don't pay attention to them, everyone starts at the same exact spot, everyone has gone through coding problems. Good for you for fixing it though man! Looking sexy! ;D

    Sponsored content

    Re: Do my C++ homework for me >:)

    Post by Sponsored content


      Current date/time is 2017-09-25, 20:56