Click here to Skip to main content
14,874,239 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
You are not thinking like a programmer ... at the moment your answers are not needed as you just display them to the console

So one easy option to patch your code in Calculation.CPP is this
void input_Area(void)  // ** Pt1 here you declare you are going to return nothing AKA a void
{
   float width = 0, length = 0, answer = 0;
   cout << "Enter the width of rectangle :";
   cin >> width;
   cout << "Enter the length of rectangle :";
   cin >> length;
   answer = rectangleArea(width, length);
   cout << "The area of Rectangle is : " << answer << endl;
}

That matches your .H header file you don't have to change anything
#ifndef _CALCULATION_H
#define _CALCULATION_H

void input_Func(void); //Input function of text.
void input_Area(void); //Input function of Area. **** FIXED NOW MATCHES THE .CPP file
void input_Trap(void); //Input function of Trapezoid.  *** STILL BUGGED .CPP says it returns a float this says void
float rectangle_Area (float , float); //Declaration for Rectangle Area.
float trapezoid_Area (float , float, float); //Declaration for Trapezoid Area.

#endif

So you could go and fix input_Trap in the same way I am leaving that as an exercise .. problem fixed.

So there is another alternative which is to return the answer in Calculation.cpp
float input_Area(void)  // ** Pt1 here you declare you are going to return a float
{
   float width = 0, length = 0, answer = 0;
   cout << "Enter the width of rectangle :";
   cin >> width;
   cout << "Enter the length of rectangle :";
   cin >> length;
   answer = rectangleArea(width, length);
   cout << "The area of Rectangle is : " << answer << endl;

   return (answer);        // * So return the answer like you said you would at Pt1
}

Now you need to fix the header file Calculation.H
#ifndef _CALCULATION_H
#define _CALCULATION_H

void input_Func(void); //Input function of text.
float input_Area(void); //Input function of Area. **** FIXED NOW MATCHES THE .CPP file above
void input_Trap(void); //Input function of Trapezoid.  *** STILL BUGGED .CPP says it returns a float this still says void
float rectangle_Area (float , float); //Declaration for Rectangle Area.
float trapezoid_Area (float , float, float); //Declaration for Trapezoid Area.

#endif

So you could go and fix input_Trap in the same way I am leaving that as an exercise .. problem fixed again.

Look carefully at both answers all that changed is whether you return answer or not. In both cases the .H file matches the .CPP file match.

Either answer is technically correct, there is no way for me to decide because it depends what you intend to do with the unit.
In vino veritas

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 
GeneralRe: Why no boundry condition set for C++ Pin
Hassan Syed111-Jun-16 5:27
MemberHassan Syed111-Jun-16 5:27 
AnswerRe: Why no boundry condition set for C++ Pin
Patrice T11-Jun-16 6:02
mvePatrice T11-Jun-16 6:02 

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.