Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Urgent please from Ethiopia!

Urgent please from Ethiopia!

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
6 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mekonnenn
    wrote on last edited by
    #1

    Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.

    CPalliniC D H N 4 Replies Last reply
    0
    • M mekonnenn

      Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Hi friend, welcome in the forum. Plese read carefully "how to get an answer to your question" [^] before actually posting. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • M mekonnenn

        Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        mekonnenn wrote:

        It is too urgent please?

        The lack of planning on your part does not constitute an emergency on our part.

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        1 Reply Last reply
        0
        • M mekonnenn

          Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          But we dont have eight queens. :-D

          Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

          L 1 Reply Last reply
          0
          • H Hamid Taebi

            But we dont have eight queens. :-D

            Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Yeah, we only have two and after Queen Astrid's accident[^] they are not allowed near or on any hill or mountain. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


            1 Reply Last reply
            0
            • M mekonnenn

              Hi friends, I am from Ethiopia. Could you please send/show me the C++ source code for 8-queens problem using hill climbing search method ? It is too urgent please? Thank you.

              N Offline
              N Offline
              nyeboy
              wrote on last edited by
              #6

              The following coding come from china. It isn't writed by mine.

              #include<stdio.h>

              #define NUM 8 //定义数组的大小

              int a[NUM+1];

              int main()

              {

              int i,k,flag,not_finish=1,count=0;

              i=1;

              a[1]=1;

              printf("The possible configuration of 8 queens are:\n");

              while(not_finish)

              {

              while(not_finish&&i<=NUM)

              {

              for(flag=1,k=1;flag&&k<i;k++)

              if(a[k]==a[i])flag=0;

              for(k=1;flag&&k<i;k++)

              if((a[i]==a[k]-(k-i))||(a[i]==a[k]+(k-i))) flag=0;

              if(!flag)

              {

              if(a[i]==a[i-1])

              {

              i--;

              if(i>1&&a[i]==NUM)

              a[i]=1;

              else if(i==1&&a[i]==NUM)

              not_finish=0;

              else a[i]++;

              }

              else if(a[i]==NUM) a[i]=1;

              else a[i]++;

              }

              else if(++i<=NUM)

              if(a[i-1]==NUM) a[i]=1;

              else a[i]=a[i-1]+1;

              }

              if(not_finish)

              {

              ++count;

              printf((count-1)%3?" [%2d]: ":" \n[%2d]: ",count);

              for(k=1;k<=NUM;k++)

              printf(" %d",a[k]);

              if(a[NUM-1]<NUM) a[NUM-1]++;

              else a[NUM-1]=1;

              i=NUM-1;

              }

              }

              }

              studing is processing in this life.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups