Welcome Guest.

2Answers

Dev-c++ code problem

Asked by: Harrison 174 views IT October 1, 2018

Title: Fully arranged;

Requirement: Replace /**/ with code to make the program set up;

Code:

#include<bits /stdc++.h>

int n,a[10];

long count=0;

void perm(int k)

{

int j,p,t;

if(/**/)

{

count++;

for(p=1;p<=n;++p)

cout<setw(1)<<a[p];

cout<<" ";

if(/**/) 

cout<endl;

return;

    }

    for(j=k;j<=n;++j)

    {

t=a[k];

a[k]=a[j];a[j]=t;

/**/;

t=a[k];

/**/;

}

    }

    void main()

    {

    int i;

    cout<< "Entry n:"<<endl;

    cin>>n;

    for(i=1;i<= n;i++) a[i]=i;

    /**/;

}

2 Answers

  1. +7Votes  

    Upstairs said dev-cpp C++ has never had void main writing is simply ridiculous, c++ void main has no mistakes, c language does not have void to say the past, simply do not understand programming, do not answer.

    The problem of full alignment requires you to implement the algorithm, which is usually implemented by bubble sorting. You need to set an intermediate variable and then create two queues. Sorted well in the final queue.

    Sarah Jones- October 1, 2018 |

  2. +1Votes  

    What is the source of your question?

    First of all, your program itself is wrong and impossible. Compiling under dev-cpp

    The program has at least 3 problems

    1. Missing

    using namespace stdl;

    2.count variable Conflicts

    count is a C++ standard STL function (defined in <algorithm>, counting sequences)

    3.void main()

    dev-cpp Is the ISO C++ standard, and C++ has never had a void main method

    compilation is wrong

    Second. Your algorithm does not look right. Fully arranged C++ itself has a function next_permutation , very simple to complete

    Thompson- October 1, 2018 |