Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//number of men or women #define N 4 //Fuctions returns true if woman \'w\' pref

ID: 3811914 • Letter: #

Question

//number of men or women #define N 4 //Fuctions returns true if woman 'w' prefers man 'ml' over man 'm' bool wPrefersM10verMC int prefer[2*N][N],int w, int m, int ml){ //Check if w prefers m over m over her current engagment m1 for (int i *0: i cN i++) VIIf ml comes before min list of w, then w prefers him if (prefer[w][i] ml) return true if (prefer[w][i] m) return false; //Print stable matching for N men and women men numbered as 0 //N-1, Women are numbered as N to 2N-1 o void stableMarriage int prefer12 NJINI //stores partner of women int wpartnertN]://indicate that (Ni) woman is free to store availabiltiy of men bool mFreetN]: //Initialize all men and wonan as free memset (wPartner, 1, size of wPartner)) meme set (mFree, false, size of (m Free)) Function definition s not allowed here

Explanation / Answer

This is a typing error.

You have just written a method inside another method. I mean you have written the method stableMarriage() before the method wPrefersM1OverM() is finished.

That's the reason it is displaying error because you can not define a method inside another method.

Currently your code structure is like this :

void wPrefersM1OverM()

{

for () {

if () {

...

} //end of first if

if () {

......

} //end of second if

} // end of for loop

void stableMarriage()

{

.....

} // end of stableMarriage code

} // this is the bracket at the last.

So, you just add a } before the line void stableMarraige() so that you can say the compiler that my method wPrefersM1OverM() is written and now I will write another one.

So, once you are adding a }, don't forget to remove the last } it is the extraneous and it should not be there.

I think this was done just because in hurry or such.. that's not a big thing and it happens sometimes.

So, do this task, your compiler will not give that error then..

Thank you. :)