Click here to Skip to main content
14,882,284 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer12-Jun-16 22:37
Memberleon de boer12-Jun-16 22:37 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed113-Jun-16 1:25
MemberHassan Syed113-Jun-16 1:25 
GeneralRe: Large project how to seprate definition and declaration? Pin
Richard MacCutchan13-Jun-16 1:46
mveRichard MacCutchan13-Jun-16 1:46 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer13-Jun-16 4:03
Memberleon de boer13-Jun-16 4:03 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed113-Jun-16 4:54
MemberHassan Syed113-Jun-16 4:54 
SuggestionRe: Large project how to seprate definition and declaration? Pin
David Crow13-Jun-16 5:23
MemberDavid Crow13-Jun-16 5:23 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer13-Jun-16 16:19
Memberleon de boer13-Jun-16 16:19 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed113-Jun-16 19:47
MemberHassan Syed113-Jun-16 19:47 
This was the whole code from main file. Please divide it in module form like professional people do so that I can exactly see the problem in my understanding of dividing the project into moduler form

/*
-------------------------
Name = Syed Sibt E Hassan
Registration Number = MC160201226
-------------------------
1) Input from the user
2) Function Calls to reactangle and trapezoid
3) Exit loop when input is not 'Y' || 'y'
*/

#include <iostream>
using namespace std;

float rectangleArea (float , float); //Declaration for Rectangle Area
float trapezoidArea (float , float, float); //Declaration for Trapezoid Area.

int main()
{
    int choice = 0;
    char tryagain = 0;
    do
      {
        cout << "\n\nEnter 1 to calculate the area of Rectangle" << endl;
        cout << "Enter 2 to calculate the area of a Trapezoid" << endl;
        cout << "\n\nEnter your choice : ";
        cin >> choice;
            switch(choice)
            {
                         //Dealing with area of Rectangle.
            case 1:
                {

                    float width = 0.0, length = 0.0, answer = 0.0;
                    cout << "Enter the width of rectangle :";
                    cin >> width;
                    cout << "Enter the length of rectangle :";
                    cin >> length;
                    answer = rectangleArea(width, length); //Function Call to Rectangle
                    cout << "The area of Rectangle is : " << answer << endl;
                    break;
                }

                         //Dealing with area of Trapezoid.
            case 2:
                {

                    float base1 = 0.0, base2 = 0.0, height = 0.0, answer = 0.0;
                    cout << "Enter base1 of trapezoid : ";
                    cin >> base1;
                    cout << "Enter base2 of trapezoid : ";
                    cin >> base2;
                    cout << "Enter the height of trapezoid : ";
                    cin >> height;
                    answer  = trapezoidArea(base1, base2, height); //Function Call to Trapezoid
                    cout << "The area of Trapezoid is : " << answer << endl;
                    break;
                }

            default:{
                cout << "Neither 1 nor 2 entered." << endl;
                }
            }

            cout << "\n Do you want to do another calculation? : ";
            cin >> tryagain;
        }while (tryagain == 'Y' || tryagain == 'y');

    return 0;
}

//Calculation of Rectangle Area.
float rectangleArea (float width, float length)
{
    float Area_Rectange = 0.0;
    Area_Rectange = width * length;
    return (Area_Rectange);
}

//Calculation of Trapezoid Area.
float trapezoidArea (float base1, float base2, float height)
{
    float Area_Trapezoid = 0.0;
    Area_Trapezoid = height * (base1 + base2)/2;
    return (Area_Trapezoid);
}

AnswerRe: Large project how to seprate definition and declaration? Pin
David Crow14-Jun-16 2:47
MemberDavid Crow14-Jun-16 2:47 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer14-Jun-16 6:06
Memberleon de boer14-Jun-16 6:06 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer14-Jun-16 10:01
Memberleon de boer14-Jun-16 10:01 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed114-Jun-16 20:34
MemberHassan Syed114-Jun-16 20:34 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 3:53
Memberleon de boer15-Jun-16 3:53 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 4:32
MemberHassan Syed115-Jun-16 4:32 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 6:21
Memberleon de boer15-Jun-16 6:21 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 7:01
MemberHassan Syed115-Jun-16 7:01 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 8:04
Memberleon de boer15-Jun-16 8:04 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 8:48
MemberHassan Syed115-Jun-16 8:48 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 20:00
Memberleon de boer15-Jun-16 20:00 
QuestionGlut errors with Mingw on windows Pin
Ratul Thakur11-Jun-16 7:03
MemberRatul Thakur11-Jun-16 7:03 
AnswerRe: Glut errors with Mingw on windows Pin
Ratul Thakur11-Jun-16 20:02
MemberRatul Thakur11-Jun-16 20:02 
GeneralRe: Glut errors with Mingw on windows Pin
leon de boer11-Jun-16 22:59
Memberleon de boer11-Jun-16 22:59 
GeneralRe: Glut errors with Mingw on windows Pin
Ratul Thakur11-Jun-16 23:59
MemberRatul Thakur11-Jun-16 23:59 
QuestionWhy no boundry condition set for C++ Pin
Hassan Syed111-Jun-16 4:52
MemberHassan Syed111-Jun-16 4:52 
AnswerRe: Why no boundry condition set for C++ Pin
Richard MacCutchan11-Jun-16 5:08
mveRichard MacCutchan11-Jun-16 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.